snipt

Ctrl+h for KB shortcuts

Text only

scope rails

includes(:class_room).where('class_rooms.course_id=? AND class_rooms.teacher_id=? AND student_histories.date = ? ',idcourse, idteacher, ClassRoom.where(course_id: idcourse).maximum(:last_cooking_date)).references(:class_room).order('student_histories.date ASC')
https://snipt.net/embed/3a8d7478c0cdd74209697c65c30d689a/
https://snipt.net/raw/3a8d7478c0cdd74209697c65c30d689a/
3a8d7478c0cdd74209697c65c30d689a
text
Text only
1
2016-09-23T07:57:04
True
False
False
/api/public/snipt/143678/
scope-rails
<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>includes(:class_room).where(&#39;class_rooms.course_id=? AND class_rooms.teacher_id=? AND student_histories.date = ? &#39;,idcourse, idteacher, ClassRoom.where(course_id: idcourse).maximum(:last_cooking_date)).references(:class_room).order(&#39;student_histories.date ASC&#39;) </span></pre></div> </td></tr></table>
model, rails, scope

PHP

Load Joomla data model from anywhere

1
2
3
4
5
6
7
8
<?php
/*http://www.corephp.com/blog/joomla-mvc-load-a-model-from-anywhere/#.T2XTvh1yx3I*/
 JLoader::import('joomla.application.component.model'); 
// file name, full path
JLoader::import( 'product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' );

$productModel = JModel::getInstance( 'Product', 'VirtueMartModel' );
?>
https://snipt.net/embed/487b0cb6746318fe388e8372e85dcde5/
https://snipt.net/raw/487b0cb6746318fe388e8372e85dcde5/
487b0cb6746318fe388e8372e85dcde5
php
PHP
8
2016-09-21T19:46:41
True
False
False
Jan 28, 2014 at 08:12 AM
/api/public/snipt/109019/
load-joomla-data-model-from-anywhere
<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 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="cm">/*http://www.corephp.com/blog/joomla-mvc-load-a-model-from-anywhere/#.T2XTvh1yx3I*/</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">JLoader</span><span class="o">::</span><span class="na">import</span><span class="p">(</span><span class="s1">&#39;joomla.application.component.model&#39;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="c1">// file name, full path</span> </span><span id="L-5"><a name="L-5"></a><span class="nx">JLoader</span><span class="o">::</span><span class="na">import</span><span class="p">(</span> <span class="s1">&#39;product&#39;</span><span class="p">,</span> <span class="nx">JPATH_ADMINISTRATOR</span> <span class="o">.</span> <span class="nx">DS</span> <span class="o">.</span> <span class="s1">&#39;components&#39;</span> <span class="o">.</span> <span class="nx">DS</span> <span class="o">.</span> <span class="s1">&#39;com_virtuemart&#39;</span> <span class="o">.</span> <span class="nx">DS</span> <span class="o">.</span> <span class="s1">&#39;models&#39;</span> <span class="p">);</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="nv">$productModel</span> <span class="o">=</span> <span class="nx">JModel</span><span class="o">::</span><span class="na">getInstance</span><span class="p">(</span> <span class="s1">&#39;Product&#39;</span><span class="p">,</span> <span class="s1">&#39;VirtueMartModel&#39;</span> <span class="p">);</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
database, joomla, model

CSS

CSS box model fix

1
2
3
4
5
6
7
Fix for the crazy CSS 2 box model

-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box;    /* Firefox, other Gecko */
box-sizing: border-box;         /* Opera/IE 8+ */

Not supported in IE6 and IE7
https://snipt.net/embed/17b46dff5a4db622c1205e97bb0d3869/
https://snipt.net/raw/17b46dff5a4db622c1205e97bb0d3869/
17b46dff5a4db622c1205e97bb0d3869
css
CSS
7
2016-09-24T12:43:42
True
False
False
/api/public/snipt/27319/
css-box-model-fix
<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 id="L-1"><a name="L-1"></a><span class="nt">Fix</span> <span class="nt">for</span> <span class="nt">the</span> <span class="nt">crazy</span> <span class="nt">CSS</span> <span class="nt">2</span> <span class="nt">box</span> <span class="nt">model</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nt">-webkit-box-sizing</span><span class="o">:</span> <span class="nt">border-box</span><span class="o">;</span> <span class="c">/* Safari/Chrome, other WebKit */</span> </span><span id="L-4"><a name="L-4"></a><span class="nt">-moz-box-sizing</span><span class="o">:</span> <span class="nt">border-box</span><span class="o">;</span> <span class="c">/* Firefox, other Gecko */</span> </span><span id="L-5"><a name="L-5"></a><span class="nt">box-sizing</span><span class="o">:</span> <span class="nt">border-box</span><span class="o">;</span> <span class="c">/* Opera/IE 8+ */</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="nt">Not</span> <span class="nt">supported</span> <span class="nt">in</span> <span class="nt">IE6</span> <span class="nt">and</span> <span class="nt">IE7</span> </span></pre></div> </td></tr></table>
box, css, model
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.