snipt

Ctrl+h for KB shortcuts

JavaScript

Min max index

1
2
3
4
5
var lowValues = [11, 9, 11.5, 7, 11.5];
var highValues = [24, 17, 28, 12, 17];

var lowestPointIndex = lowValues.indexOf( Math.min.apply( Math, lowValues ) );
var highestPointIndex = highValues.indexOf( Math.max.apply( Math, highValues ) );
https://snipt.net/embed/d575560a8b2e600977ea05de32635933/
/raw/d575560a8b2e600977ea05de32635933/
d575560a8b2e600977ea05de32635933
js
JavaScript
5
2019-08-22T07:58:38
True
False
False
Apr 28, 2014 at 05:49 PM
/api/public/snipt/133667/
min-max-index-472cf9ac
<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="kd">var</span> <span class="nx">lowValues</span> <span class="o">=</span> <span class="p">[</span><span class="mi">11</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mf">11.5</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mf">11.5</span><span class="p">];</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">var</span> <span class="nx">highValues</span> <span class="o">=</span> <span class="p">[</span><span class="mi">24</span><span class="p">,</span> <span class="mi">17</span><span class="p">,</span> <span class="mi">28</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">17</span><span class="p">];</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="kd">var</span> <span class="nx">lowestPointIndex</span> <span class="o">=</span> <span class="nx">lowValues</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span> <span class="nb">Math</span><span class="p">,</span> <span class="nx">lowValues</span> <span class="p">)</span> <span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="kd">var</span> <span class="nx">highestPointIndex</span> <span class="o">=</span> <span class="nx">highValues</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span> <span class="nb">Math</span><span class="p">,</span> <span class="nx">highValues</span> <span class="p">)</span> <span class="p">);</span> </span></pre></div> </td></tr></table>
max, min

Objective-C

Rotate object

1
2
3
4
5
6
#define RADIANS( degrees ) ( ( degrees * M_PI ) / 180.0 )

CGAffineTransform rotateTransform = CGAffineTransformRotate( CGAffineTransformIdentity,
         RADIANS( 45.0 ) );

object.transform = rotateTransform;
https://snipt.net/embed/a179c073e48f3026812ce4842099a593/
/raw/a179c073e48f3026812ce4842099a593/
a179c073e48f3026812ce4842099a593
objective-c
Objective-C
6
2019-08-24T17:18:14
True
False
False
Feb 18, 2014 at 10:52 AM
/api/public/snipt/114780/
rotate-object
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">#define RADIANS( degrees ) ( ( degrees * M_PI ) / 180.0 )</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="bp">CGAffineTransform</span> <span class="n">rotateTransform</span> <span class="o">=</span> <span class="n">CGAffineTransformRotate</span><span class="p">(</span> <span class="n">CGAffineTransformIdentity</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a> <span class="n">RADIANS</span><span class="p">(</span> <span class="mf">45.0</span> <span class="p">)</span> <span class="p">);</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="n">object</span><span class="p">.</span><span class="n">transform</span> <span class="o">=</span> <span class="n">rotateTransform</span><span class="p">;</span> </span></pre></div> </td></tr></table>
rotate, rotation

CSS

clear placeholder

1
2
3
4
input:focus::-webkit-input-placeholder
{
	color: transparent;
}
https://snipt.net/embed/620afb440037610f4b9ee71f999a5913/
/raw/620afb440037610f4b9ee71f999a5913/
620afb440037610f4b9ee71f999a5913
css
CSS
4
2019-08-21T12:21:37
True
False
False
May 06, 2013 at 12:22 PM
/api/public/snipt/60785/
clear-placeholder
<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="nt">input</span><span class="nd">:focus</span><span class="o">:</span><span class="nd">:-webkit-input-placeholder</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="nb">color</span><span class="o">:</span> <span class="nb">transparent</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>
clear, css, placeholder