Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

Inject data into a module position

1
2
3
4
5
<?php
// Inject data from your component into the right module position
JFactory::getDocument()->setBuffer($data, 'modules', 'right');

// Note: Data will not be shown unless there are "real" modules present in position right
https://snipt.net/embed/130d081d59867fbbba5a542407fc5b69/
https://snipt.net/raw/130d081d59867fbbba5a542407fc5b69/
130d081d59867fbbba5a542407fc5b69
php
PHP
5
2016-12-02T08:37:16
True
False
False
Apr 01, 2014 at 11:55 AM
/api/public/snipt/126514/
inject-data-into-a-module-position-1
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">// Inject data from your component into the right module position</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">JFactory</span><span class="o">::</span><span class="na">getDocument</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">setBuffer</span><span class="p">(</span><span class="nv">$data</span><span class="p">,</span> <span class="s1">&#39;modules&#39;</span><span class="p">,</span> <span class="s1">&#39;right&#39;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1">// Note: Data will not be shown unless there are &quot;real&quot; modules present in position right</span> </span></pre></div> </td></tr></table>
joomla, module, position

JavaScript

Show mouse position

1
2
3
4
5
document.onmousemove = function(e){
var x = e.pageX;
var y = e.pageY;
e.target.title = "X is "+x+" and Y is "+y;
};
https://snipt.net/embed/3fab55f3265b101be9d17e61bfc020be/
https://snipt.net/raw/3fab55f3265b101be9d17e61bfc020be/
3fab55f3265b101be9d17e61bfc020be
js
JavaScript
5
2016-12-02T20:34:13
True
False
False
Mar 20, 2014 at 05:41 AM
/api/public/snipt/123302/
show-mouse-position
<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="nb">document</span><span class="p">.</span><span class="nx">onmousemove</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">var</span> <span class="nx">x</span> <span class="o">=</span> <span class="nx">e</span><span class="p">.</span><span class="nx">pageX</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="kd">var</span> <span class="nx">y</span> <span class="o">=</span> <span class="nx">e</span><span class="p">.</span><span class="nx">pageY</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="nx">e</span><span class="p">.</span><span class="nx">target</span><span class="p">.</span><span class="nx">title</span> <span class="o">=</span> <span class="s2">&quot;X is &quot;</span><span class="o">+</span><span class="nx">x</span><span class="o">+</span><span class="s2">&quot; and Y is &quot;</span><span class="o">+</span><span class="nx">y</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a><span class="p">};</span> </span></pre></div> </td></tr></table>
absolute, coordinates, mouse, position

PHP

Module position count

1
2
3
4
5
<?php if ($this->countModules( 'position' )) : ?>
  <div>
    <jdoc:include type="modules" name="position" />
  </div>
<?php endif; ?>
https://snipt.net/embed/fb456f32b8fe58fb96fbd70db002da6e/
https://snipt.net/raw/fb456f32b8fe58fb96fbd70db002da6e/
fb456f32b8fe58fb96fbd70db002da6e
php
PHP
5
2016-12-02T08:37:32
True
False
False
Sep 25, 2013 at 02:25 PM
/api/public/snipt/67730/
module-position-count
<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="cp">&lt;?php</span> <span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">countModules</span><span class="p">(</span> <span class="s1">&#39;position&#39;</span> <span class="p">))</span> <span class="o">:</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="x"> &lt;div&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> &lt;jdoc:include type=&quot;modules&quot; name=&quot;position&quot; /&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> &lt;/div&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">&lt;?php</span> <span class="k">endif</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
count, joomla, module, position, template

JavaScript

SlimTimmer - Open Timer to the top right

javascript:newwindow=window.open('http://slimtimer.com/client/','slimtimer','resizable=1,toolbar=0,location=0,status=1,menubar=0,scrollbars=1,width=175,height=700,left=2400,top=20');newwindow.focus();
https://snipt.net/embed/4424f42ed6e1f81508f5693959d37003/
https://snipt.net/raw/4424f42ed6e1f81508f5693959d37003/
4424f42ed6e1f81508f5693959d37003
js
JavaScript
1
2016-12-04T05:10:36
True
False
False
May 14, 2013 at 10:23 AM
/api/public/snipt/61299/
slimtimmer-open-timer-to-the-top-right
<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="nx">javascript</span><span class="o">:</span><span class="nx">newwindow</span><span class="o">=</span><span class="nb">window</span><span class="p">.</span><span class="nx">open</span><span class="p">(</span><span class="s1">&#39;http://slimtimer.com/client/&#39;</span><span class="p">,</span><span class="s1">&#39;slimtimer&#39;</span><span class="p">,</span><span class="s1">&#39;resizable=1,toolbar=0,location=0,status=1,menubar=0,scrollbars=1,width=175,height=700,left=2400,top=20&#39;</span><span class="p">);</span><span class="nx">newwindow</span><span class="p">.</span><span class="nx">focus</span><span class="p">();</span> </span></pre></div> </td></tr></table>
"time tracking", "work tool", bunny, open, position, slimtimer, timer, window

Java

Java get absolute Mouse position on screen

Point location = MouseInfo.getPointerInfo().getLocation();
System.out.println(location.x + ":" + location.y);
https://snipt.net/embed/6454b6562c539e7b0b2c25379eb7e75f/
https://snipt.net/raw/6454b6562c539e7b0b2c25379eb7e75f/
6454b6562c539e7b0b2c25379eb7e75f
java
Java
2
2016-12-03T14:46:30
True
False
False
/api/public/snipt/23243/
java-get-absolute-mouse-position-on-screen
<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">Point</span> <span class="n">location</span> <span class="o">=</span> <span class="n">MouseInfo</span><span class="o">.</span><span class="na">getPointerInfo</span><span class="o">().</span><span class="na">getLocation</span><span class="o">();</span> </span><span id="L-2"><a name="L-2"></a><span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">location</span><span class="o">.</span><span class="na">x</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="n">location</span><span class="o">.</span><span class="na">y</span><span class="o">);</span> </span></pre></div> </td></tr></table>
coordinates, java, mouse, onscreen, pointer, position, screen

JavaScript

google map position

1
2
3
4
GEvent.addListener(map,"click", function(overlay,latlng) {     
var myHtml = "GPoint ?? " + map.fromLatLngToDivPixel(latlng) + "?<br>??????" + map.getZoom();
map.openInfoWindow(latlng, myHtml);
});
https://snipt.net/embed/a5100e6f262ddd810d5e873a30c080bf/
https://snipt.net/raw/a5100e6f262ddd810d5e873a30c080bf/
a5100e6f262ddd810d5e873a30c080bf
js
JavaScript
5
2016-12-02T20:34:17
True
False
False
/api/public/snipt/13279/
google-map-1
<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="nx">GEvent</span><span class="p">.</span><span class="nx">addListener</span><span class="p">(</span><span class="nx">map</span><span class="p">,</span><span class="s2">&quot;click&quot;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">overlay</span><span class="p">,</span><span class="nx">latlng</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">var</span> <span class="nx">myHtml</span> <span class="o">=</span> <span class="s2">&quot;GPoint ?? &quot;</span> <span class="o">+</span> <span class="nx">map</span><span class="p">.</span><span class="nx">fromLatLngToDivPixel</span><span class="p">(</span><span class="nx">latlng</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;?&lt;br&gt;??????&quot;</span> <span class="o">+</span> <span class="nx">map</span><span class="p">.</span><span class="nx">getZoom</span><span class="p">();</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">map</span><span class="p">.</span><span class="nx">openInfoWindow</span><span class="p">(</span><span class="nx">latlng</span><span class="p">,</span> <span class="nx">myHtml</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>
google, map, position
Copyrighted, illegal, or inappropriate content? Email [email protected].