snipt

Ctrl+h for KB shortcuts

SQL

Easy way to trim white spaces from the start of text values in a database column.

UPDATE [databasenamehere].[dbo].[tablenamehere] SET [columnnamehere] = LTRIM([columnnamehere]);
https://snipt.net/embed/0c17d1e9cc63bc516a36240c09b03d90/
/raw/0c17d1e9cc63bc516a36240c09b03d90/
0c17d1e9cc63bc516a36240c09b03d90
sql
SQL
1
2019-06-16T14:25:20
True
False
False
/api/public/snipt/35567/
easy-way-to-trim-white-spaces-from-the-start-of-text-values-in-a-database-column
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">UPDATE</span> <span class="p">[</span><span class="n">databasenamehere</span><span class="p">].[</span><span class="n">dbo</span><span class="p">].[</span><span class="n">tablenamehere</span><span class="p">]</span> <span class="k">SET</span> <span class="p">[</span><span class="n">columnnamehere</span><span class="p">]</span> <span class="o">=</span> <span class="n">LTRIM</span><span class="p">([</span><span class="n">columnnamehere</span><span class="p">]);</span> </span></pre></div> </td></tr></table>
sql

SQL

Search and replace words in a MS SQL database.

1
2
3
4
UPDATE [databasenamehere].[dbo].[tablenamehere] 
SET [columnnamehere] = REPLACE ([columnnamehere],
'texttoreplacehere',
'replacementtexthere');
https://snipt.net/embed/8d042aef186b35d5852293894babecb1/
/raw/8d042aef186b35d5852293894babecb1/
8d042aef186b35d5852293894babecb1
sql
SQL
4
2019-06-03T23:51:15
True
False
False
/api/public/snipt/35566/
search-and-replace-words-in-a-ms-sql-database
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">UPDATE</span> <span class="p">[</span><span class="n">databasenamehere</span><span class="p">].[</span><span class="n">dbo</span><span class="p">].[</span><span class="n">tablenamehere</span><span class="p">]</span> </span><span id="L-2"><a name="L-2"></a><span class="k">SET</span> <span class="p">[</span><span class="n">columnnamehere</span><span class="p">]</span> <span class="o">=</span> <span class="k">REPLACE</span> <span class="p">([</span><span class="n">columnnamehere</span><span class="p">],</span> </span><span id="L-3"><a name="L-3"></a><span class="s1">&#39;texttoreplacehere&#39;</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a><span class="s1">&#39;replacementtexthere&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
sql

SQL

Bit SQL to copy the contents of one column to another with the same table.

UPDATE [databasenamehere].[dbo].[tablenamehere]
   SET [columnnamehere] = [columnnamehere]
https://snipt.net/embed/122a0d28c4dff327bf12f6d42365114b/
/raw/122a0d28c4dff327bf12f6d42365114b/
122a0d28c4dff327bf12f6d42365114b
sql
SQL
2
2019-06-07T00:07:46
True
False
False
/api/public/snipt/35550/
bit-sql-to-copy-the-contents-of-one-column-to-another-with-the-same-table
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">UPDATE</span> <span class="p">[</span><span class="n">databasenamehere</span><span class="p">].[</span><span class="n">dbo</span><span class="p">].[</span><span class="n">tablenamehere</span><span class="p">]</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">SET</span> <span class="p">[</span><span class="n">columnnamehere</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">columnnamehere</span><span class="p">]</span> </span></pre></div> </td></tr></table>
sql

C#

Get's the client's IP Address.

1
2
3
4
public string GetIPAddress()
{
    return HttpContext.Current.Request.UserHostAddress;
}
https://snipt.net/embed/49df9c4eafe7ca2535e13d2fb38cbb25/
/raw/49df9c4eafe7ca2535e13d2fb38cbb25/
49df9c4eafe7ca2535e13d2fb38cbb25
csharp
C#
4
2019-06-10T15:09:08
True
False
False
/api/public/snipt/35459/
gets-the-clients-ip-address
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">public</span> <span class="kt">string</span> <span class="nf">GetIPAddress</span><span class="p">()</span> </span><span id="L-2"><a name="L-2"></a><span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="n">HttpContext</span><span class="p">.</span><span class="n">Current</span><span class="p">.</span><span class="n">Request</span><span class="p">.</span><span class="n">UserHostAddress</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
c#

SQL

This basic SQL query will produce only unique counties from our list and in order.

1
2
3
SELECT DISTINCT county
FROM townsandcountylist
ORDER BY county
https://snipt.net/embed/45c3d111c8e25a7c78851c8428cbd54d/
/raw/45c3d111c8e25a7c78851c8428cbd54d/
45c3d111c8e25a7c78851c8428cbd54d
sql
SQL
3
2019-06-10T07:52:10
True
False
False
/api/public/snipt/34635/
this-basic-sql-query-will-produce-only-unique-counties-from-our-list-and-in-order
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="k">DISTINCT</span> <span class="n">county</span> </span><span id="L-2"><a name="L-2"></a><span class="k">FROM</span> <span class="n">townsandcountylist</span> </span><span id="L-3"><a name="L-3"></a><span class="k">ORDER</span> <span class="k">BY</span> <span class="n">county</span> </span></pre></div> </td></tr></table>
sql

SQL

Basic SQL Example, may return ordered duplicates.

1
2
3
SELECT county
FROM townsandcountylist
ORDER BY county
https://snipt.net/embed/f37edce31018d7ab8a9ce1fc004807c9/
/raw/f37edce31018d7ab8a9ce1fc004807c9/
f37edce31018d7ab8a9ce1fc004807c9
sql
SQL
3
2019-06-10T12:17:02
True
False
False
/api/public/snipt/34634/
basic-sql-example-may-return-ordered-duplicates
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="n">county</span> </span><span id="L-2"><a name="L-2"></a><span class="k">FROM</span> <span class="n">townsandcountylist</span> </span><span id="L-3"><a name="L-3"></a><span class="k">ORDER</span> <span class="k">BY</span> <span class="n">county</span> </span></pre></div> </td></tr></table>
sql

HTML

The mark up to make a hyper link perform a phone call when touched.

1
2
3
<a href="tel:0818224433">
Call Quoteme.ie on 0818 22 44 33
</a>.
https://snipt.net/embed/36d3b95f7c05aff43cc90ea64cf89ddc/
/raw/36d3b95f7c05aff43cc90ea64cf89ddc/
36d3b95f7c05aff43cc90ea64cf89ddc
html
HTML
3
2019-06-14T11:14:51
True
False
False
/api/public/snipt/33732/
the-mark-up-to-make-a-hyper-link-perform-a-phone-call-when-touched
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;tel:0818224433&quot;</span><span class="p">&gt;</span> </span><span id="L-2"><a name="L-2"></a>Call Quoteme.ie on 0818 22 44 33 </span><span id="L-3"><a name="L-3"></a><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>. </span></pre></div> </td></tr></table>
"andriod call me link", "iphone call me link", "windows phone call me link"

XML

Remove .aspx from Umbraco URLs

1
2
3
4
5
6
7
<add name=”trim_aspx_from_directory_urls”
redirect=”Application”
redirectMode=”Permanent”
virtualUrl=”^/(?![0-9]+.aspx)(?!umbraco/)(.*).aspx$”
rewriteUrlParameter=”ExcludeFromClientQueryString”
destinationUrl=”/$1”
ignoreCase=”true” />
https://snipt.net/embed/117aa6303ef9294fdf8d3102a1cedc6f/
/raw/117aa6303ef9294fdf8d3102a1cedc6f/
117aa6303ef9294fdf8d3102a1cedc6f
xml
XML
7
2019-06-13T17:05:56
True
False
False
/api/public/snipt/33575/
remove-aspx-from-umbraco-urls
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nt">&lt;add</span> <span class="na">name=</span><span class="s">”trim_aspx_from_directory_urls”</span> </span><span id="L-2"><a name="L-2"></a><span class="na">redirect=</span><span class="s">”Application”</span> </span><span id="L-3"><a name="L-3"></a><span class="na">redirectMode=</span><span class="s">”Permanent”</span> </span><span id="L-4"><a name="L-4"></a><span class="na">virtualUrl=</span><span class="s">”^/(?![0-9]+.aspx)(?!umbraco/)(.*).aspx$”</span> </span><span id="L-5"><a name="L-5"></a><span class="na">rewriteUrlParameter=</span><span class="s">”ExcludeFromClientQueryString”</span> </span><span id="L-6"><a name="L-6"></a><span class="na">destinationUrl=</span><span class="s">”/$1”</span> </span><span id="L-7"><a name="L-7"></a><span class="na">ignoreCase=</span><span class="s">”true”</span> <span class="nt">/&gt;</span> </span></pre></div> </td></tr></table>
.aspx, umbraco