Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

C#

Remove null items from a generic List

List<EmailParameterClass> parameterList = new List<EmailParameterClass>{param1, param2, param3...};
parameterList.RemoveAll(item => item == null);
https://snipt.net/embed/33e0fe6e9edded30df94595e85284c44/
https://snipt.net/raw/33e0fe6e9edded30df94595e85284c44/
33e0fe6e9edded30df94595e85284c44
csharp
C#
2
2016-12-09T09:46:07
True
False
False
/api/public/snipt/101188/
remove-null-items-from-a-generic-list
<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="n">List</span><span class="p">&lt;</span><span class="n">EmailParameterClass</span><span class="p">&gt;</span> <span class="n">parameterList</span> <span class="p">=</span> <span class="k">new</span> <span class="n">List</span><span class="p">&lt;</span><span class="n">EmailParameterClass</span><span class="p">&gt;{</span><span class="n">param1</span><span class="p">,</span> <span class="n">param2</span><span class="p">,</span> <span class="n">param3</span><span class="p">...};</span> </span><span id="L-2"><a name="L-2"></a><span class="n">parameterList</span><span class="p">.</span><span class="n">RemoveAll</span><span class="p">(</span><span class="n">item</span> <span class="p">=&gt;</span> <span class="n">item</span> <span class="p">==</span> <span class="k">null</span><span class="p">);</span> </span></pre></div> </td></tr></table>
tmp

Python

test

1
2
3
4
5
#!/usr/bin/env python

import sys

print sys.argv[1]
https://snipt.net/embed/c28f591028d422f78def8c4a7dd311a0/
https://snipt.net/raw/c28f591028d422f78def8c4a7dd311a0/
c28f591028d422f78def8c4a7dd311a0
python
Python
5
2016-12-09T09:46:55
True
False
False
/api/public/snipt/47815/
test-175
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="ch">#!/usr/bin/env python</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="kn">import</span> <span class="nn">sys</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="k">print</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> </span></pre></div> </td></tr></table>
tmp

Text only

Untitled

1
2
3
4
5
6
7
8
document.onkeydown=function(e){
	if(e.which == 17) isCtrl=true;
	if(e.which == 16) isShift=true;
	if(e.which == 83 && isCtrl == true && isShift == true) {
		chrome.extension.sendRequest({ msg: "saveSelection" });
		return false;
	}
}
https://snipt.net/embed/a03b7cae41256eb86b32f798fc531a3a/
https://snipt.net/raw/a03b7cae41256eb86b32f798fc531a3a/
a03b7cae41256eb86b32f798fc531a3a
text
Text only
8
2016-12-09T09:48:51
True
False
False
/api/public/snipt/43527/
-472
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>document.onkeydown=function(e){ </span><span id="L-2"><a name="L-2"></a> if(e.which == 17) isCtrl=true; </span><span id="L-3"><a name="L-3"></a> if(e.which == 16) isShift=true; </span><span id="L-4"><a name="L-4"></a> if(e.which == 83 &amp;&amp; isCtrl == true &amp;&amp; isShift == true) { </span><span id="L-5"><a name="L-5"></a> chrome.extension.sendRequest({ msg: &quot;saveSelection&quot; }); </span><span id="L-6"><a name="L-6"></a> return false; </span><span id="L-7"><a name="L-7"></a> } </span><span id="L-8"><a name="L-8"></a>} </span></pre></div> </td></tr></table>
tmp
Copyrighted, illegal, or inappropriate content? Email [email protected].