snipt

Ctrl+h for KB shortcuts
#25561

Bash

Install a new Git repo

1
2
3
4
# add this to your .bash_profile
# usage: gitinstall http://github.com/path/to/git.git

function gitinstall(){ git init; git remote add origin "$@"; git config branch.master.remote origin; git config branch.master.merge refs/heads/master; git pull;}
https://snipt.net/embed/9517cb33519115158749a04f0dfe8758/
https://snipt.net/raw/9517cb33519115158749a04f0dfe8758/
9517cb33519115158749a04f0dfe8758
bash
Bash
4
2014-04-13T20:30:18
True
False
/api/public/snipt/25561/
install-a-new-git-repo
<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 id="L-1"><a name="L-1"></a><span class="c"># add this to your .bash_profile</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># usage: gitinstall http://github.com/path/to/git.git</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">function </span>gitinstall<span class="o">(){</span> git init<span class="p">;</span> git remote add origin <span class="s2">&quot;$@&quot;</span><span class="p">;</span> git config branch.master.remote origin<span class="p">;</span> git config branch.master.merge refs/heads/master<span class="p">;</span> git pull<span class="p">;</span><span class="o">}</span> </span></pre></div> </td></tr></table>
bash, git, install, setup
#24930

Bash

Batch Convert CLRF to LF

find . -type f -exec perl -pi -e 's/\r\n?/\n/g' {} \;
https://snipt.net/embed/6a39fef114e96fe2c37001fc0a3b5492/
https://snipt.net/raw/6a39fef114e96fe2c37001fc0a3b5492/
6a39fef114e96fe2c37001fc0a3b5492
bash
Bash
1
2014-04-10T21:26:14
True
False
/api/public/snipt/24930/
batch-convert-clrf-to-lf
<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 id="L-1"><a name="L-1"></a>find . -type f -exec perl -pi -e <span class="s1">&#39;s/\r\n?/\n/g&#39;</span> <span class="o">{}</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
"line endings", dos, unix
#22207

Bash

Open current dir in Finder

/usr/bin/osascript -e "tell application \"Finder\" to open POSIX file \"`pwd`\""
https://snipt.net/embed/32e3b49093b665015a6bd065c953158f/
https://snipt.net/raw/32e3b49093b665015a6bd065c953158f/
32e3b49093b665015a6bd065c953158f
bash
Bash
2
2014-04-15T22:11:17
True
False
/api/public/snipt/22207/
open-current-dir-in-finder
<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 id="L-1"><a name="L-1"></a>/usr/bin/osascript -e <span class="s2">&quot;tell application \&quot;Finder\&quot; to open POSIX file \&quot;`pwd`\&quot;&quot;</span> </span></pre></div> </td></tr></table>
"mac os", bash, finder, osx
#17067

JavaScript

Immediate callback of a function

1
2
3
(function(window,document,undefined){
……
})(this,document);
https://snipt.net/embed/3d9fe60670a963a35b82c0a090a0a686/
https://snipt.net/raw/3d9fe60670a963a35b82c0a090a0a686/
3d9fe60670a963a35b82c0a090a0a686
js
JavaScript
3
2014-03-15T08:04:53
True
False
/api/public/snipt/17067/
immediate-callback-of-a-function
<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 id="L-1"><a name="L-1"></a><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nb">window</span><span class="p">,</span><span class="nb">document</span><span class="p">,</span><span class="kc">undefined</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a><span class="err">……</span> </span><span id="L-3"><a name="L-3"></a><span class="p">})(</span><span class="k">this</span><span class="p">,</span><span class="nb">document</span><span class="p">);</span> </span></pre></div> </td></tr></table>
javascript
#16817

JavaScript

Write reconciled value to cell

cell.recon.match.name
https://snipt.net/embed/767e170355de16c9e2b2f47ee5c1c10c/
https://snipt.net/raw/767e170355de16c9e2b2f47ee5c1c10c/
767e170355de16c9e2b2f47ee5c1c10c
js
JavaScript
1
2014-04-03T21:46:40
True
False
/api/public/snipt/16817/
write-reconciled-value-to-cell
<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 id="L-1"><a name="L-1"></a><span class="nx">cell</span><span class="p">.</span><span class="nx">recon</span><span class="p">.</span><span class="nx">match</span><span class="p">.</span><span class="nx">name</span> </span></pre></div> </td></tr></table>
data, gel, gridworks