| \Session::flash('success', "rows imported successfully.");
$request->session()->flash('danger', "There were $num_errors errors.");
|
https://snipt.net/embed/ae12ecf7b516246d961ed5eab8cef527/
/raw/ae12ecf7b516246d961ed5eab8cef527/
ae12ecf7b516246d961ed5eab8cef527
text
Text only
3
2025-04-03T15:22:01
True
False
False
Dec 18, 2017 at 11:52 PM
/api/public/snipt/18/
flash-message
<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>\Session::flash('success', "rows imported successfully.");
</span><span id="L-2"><a name="L-2"></a>$request->session()->flash('danger', "There were $num_errors errors.");
</span></pre></div>
</td></tr></table>
laravel
| //First Add this to extend jQuery
$.extend({
getUrlVars: function(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
},
getUrlVar: function(name){
return $.getUrlVars()[name];
}
});
//Second call with this:
// Get object of URL parameters
var allVars = $.getUrlVars();
// Getting URL var by its name
var byName = $.getUrlVar('name');
|
Expand
Collapse
(25 lines)
https://snipt.net/embed/9ec0ddb8462e764d31605633ca12403e/
/raw/9ec0ddb8462e764d31605633ca12403e/
9ec0ddb8462e764d31605633ca12403e
text
Text only
25
2025-04-03T15:47:34
True
False
False
/api/public/snipt/17/
jquery-get-query-string-param
<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>
<a href="#L-9"> 9</a>
<a href="#L-10">10</a>
<a href="#L-11">11</a>
<a href="#L-12">12</a>
<a href="#L-13">13</a>
<a href="#L-14">14</a>
<a href="#L-15">15</a>
<a href="#L-16">16</a>
<a href="#L-17">17</a>
<a href="#L-18">18</a>
<a href="#L-19">19</a>
<a href="#L-20">20</a>
<a href="#L-21">21</a>
<a href="#L-22">22</a>
<a href="#L-23">23</a>
<a href="#L-24">24</a>
<a href="#L-25">25</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>//First Add this to extend jQuery
</span><span id="L-2"><a name="L-2"></a>
</span><span id="L-3"><a name="L-3"></a> $.extend({
</span><span id="L-4"><a name="L-4"></a> getUrlVars: function(){
</span><span id="L-5"><a name="L-5"></a> var vars = [], hash;
</span><span id="L-6"><a name="L-6"></a> var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
</span><span id="L-7"><a name="L-7"></a> for(var i = 0; i < hashes.length; i++)
</span><span id="L-8"><a name="L-8"></a> {
</span><span id="L-9"><a name="L-9"></a> hash = hashes[i].split('=');
</span><span id="L-10"><a name="L-10"></a> vars.push(hash[0]);
</span><span id="L-11"><a name="L-11"></a> vars[hash[0]] = hash[1];
</span><span id="L-12"><a name="L-12"></a> }
</span><span id="L-13"><a name="L-13"></a> return vars;
</span><span id="L-14"><a name="L-14"></a> },
</span><span id="L-15"><a name="L-15"></a> getUrlVar: function(name){
</span><span id="L-16"><a name="L-16"></a> return $.getUrlVars()[name];
</span><span id="L-17"><a name="L-17"></a> }
</span><span id="L-18"><a name="L-18"></a> });
</span><span id="L-19"><a name="L-19"></a>
</span><span id="L-20"><a name="L-20"></a> //Second call with this:
</span><span id="L-21"><a name="L-21"></a> // Get object of URL parameters
</span><span id="L-22"><a name="L-22"></a> var allVars = $.getUrlVars();
</span><span id="L-23"><a name="L-23"></a>
</span><span id="L-24"><a name="L-24"></a> // Getting URL var by its name
</span><span id="L-25"><a name="L-25"></a> var byName = $.getUrlVar('name');
</span></pre></div>
</td></tr></table>
jquery
| mysqldump --routines newsroom > newsroom-alpha-2017-11-15.sql
|
https://snipt.net/embed/c94d576f20b3f94a10a2afc53ce41291/
/raw/c94d576f20b3f94a10a2afc53ce41291/
c94d576f20b3f94a10a2afc53ce41291
text
Text only
1
2025-04-03T15:27:27
True
False
False
Nov 15, 2017 at 04:45 PM
/api/public/snipt/16/
mysqldump
<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>mysqldump --routines newsroom > newsroom-alpha-2017-11-15.sql
</span></pre></div>
</td></tr></table>
mysql
| input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type="number"] {
-moz-appearance: textfield;
}
|
Expand
Collapse
(10 lines)
https://snipt.net/embed/5d58416e2bbd77130858dc28d7aaf9a2/
/raw/5d58416e2bbd77130858dc28d7aaf9a2/
5d58416e2bbd77130858dc28d7aaf9a2
text
Text only
10
2025-04-03T15:52:58
True
False
False
Nov 01, 2017 at 01:22 PM
/api/public/snipt/15/
remove-spinner-from-number-input-type
<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>input[type="number"]::-webkit-outer-spin-button,
</span><span id="L-2"><a name="L-2"></a>input[type="number"]::-webkit-inner-spin-button {
</span><span id="L-3"><a name="L-3"></a> -webkit-appearance: none;
</span><span id="L-4"><a name="L-4"></a> margin: 0;
</span><span id="L-5"><a name="L-5"></a>}
</span><span id="L-6"><a name="L-6"></a>input[type="number"] {
</span><span id="L-7"><a name="L-7"></a> -moz-appearance: textfield;
</span><span id="L-8"><a name="L-8"></a>}
</span></pre></div>
</td></tr></table>
css
| {% if content.field_example|render|striptags|trim %}
<p>field is not empty</p>
{% endif %}
|
https://snipt.net/embed/c211c83ea29e36f093de8732d330112a/
/raw/c211c83ea29e36f093de8732d330112a/
c211c83ea29e36f093de8732d330112a
text
Text only
3
2025-04-03T15:34:09
True
False
False
Aug 02, 2017 at 05:02 PM
/api/public/snipt/14/
twig-is-field-empty
<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></span><span id="L-1"><a name="L-1"></a>{% if content.field_example|render|striptags|trim %}
</span><span id="L-2"><a name="L-2"></a> <p>field is not empty</p>
</span><span id="L-3"><a name="L-3"></a>{% endif %}
</span></pre></div>
</td></tr></table>
drupal
| $items = ArrayHelper::map(Standard::find()->all(), 's_id', 'name');
|
https://snipt.net/embed/9fb5c0940f4f98b23d33217a9866392c/
/raw/9fb5c0940f4f98b23d33217a9866392c/
9fb5c0940f4f98b23d33217a9866392c
text
Text only
1
2025-04-03T15:46:48
True
False
False
Jul 16, 2017 at 03:28 AM
/api/public/snipt/13/
model-array-map-for-dropdown
<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>$items = ArrayHelper::map(Standard::find()->all(), 's_id', 'name');
</span></pre></div>
</td></tr></table>
| $array = array_map('trim', $array);
|
https://snipt.net/embed/46dbf29d4d32a9b201cb7a7da3c62c57/
/raw/46dbf29d4d32a9b201cb7a7da3c62c57/
46dbf29d4d32a9b201cb7a7da3c62c57
text
Text only
1
2025-04-03T00:05:48
True
False
False
Apr 11, 2017 at 01:50 AM
/api/public/snipt/12/
trim-array
<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>$array = array_map('trim', $array);
</span></pre></div>
</td></tr></table>
php
| -- Drop the constraint if it exists
set @var=if((SELECT true FROM information_schema.TABLE_CONSTRAINTS WHERE
CONSTRAINT_SCHEMA = DATABASE() AND
TABLE_NAME = 'bluebookfacts' AND
CONSTRAINT_NAME = 'fk_bb_log_facts' AND
CONSTRAINT_TYPE = 'FOREIGN KEY') = true,'ALTER TABLE bluebook DROP FOREIGN KEY fk_bb_log_facts', 'select 1');
prepare stmt from @var;
execute stmt;
deallocate prepare stmt;
|
Expand
Collapse
(9 lines)
https://snipt.net/embed/09601d166c92af3b299cd0cc0a3a8154/
/raw/09601d166c92af3b299cd0cc0a3a8154/
09601d166c92af3b299cd0cc0a3a8154
text
Text only
9
2025-04-03T15:54:47
True
False
False
Feb 08, 2017 at 03:16 PM
/api/public/snipt/11/
drop-the-constraint-if-it-exists
<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>
<a href="#L-9">9</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>-- Drop the constraint if it exists
</span><span id="L-2"><a name="L-2"></a>set @var=if((SELECT true FROM information_schema.TABLE_CONSTRAINTS WHERE
</span><span id="L-3"><a name="L-3"></a> CONSTRAINT_SCHEMA = DATABASE() AND
</span><span id="L-4"><a name="L-4"></a> TABLE_NAME = 'bluebookfacts' AND
</span><span id="L-5"><a name="L-5"></a> CONSTRAINT_NAME = 'fk_bb_log_facts' AND
</span><span id="L-6"><a name="L-6"></a> CONSTRAINT_TYPE = 'FOREIGN KEY') = true,'ALTER TABLE bluebook DROP FOREIGN KEY fk_bb_log_facts', 'select 1');
</span><span id="L-7"><a name="L-7"></a>prepare stmt from @var;
</span><span id="L-8"><a name="L-8"></a>execute stmt;
</span><span id="L-9"><a name="L-9"></a>deallocate prepare stmt;
</span></pre></div>
</td></tr></table>
mysql
| <?= $form->errorSummary($model); ?>
|
https://snipt.net/embed/cf17fa68e973d4b8f30a6fc5e12f156c/
/raw/cf17fa68e973d4b8f30a6fc5e12f156c/
cf17fa68e973d4b8f30a6fc5e12f156c
text
Text only
2
2025-04-03T15:31:19
True
False
False
Feb 05, 2017 at 02:11 AM
/api/public/snipt/10/
form-error-summary
<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><?= $form->errorSummary($model); ?>
</span></pre></div>
</td></tr></table>
yii
| Html::activeHiddenInput($model, 'group_id', ['value' => $group_id])
|
https://snipt.net/embed/b4ea58d052a21292d2848ddb2022a2b4/
/raw/b4ea58d052a21292d2848ddb2022a2b4/
b4ea58d052a21292d2848ddb2022a2b4
text
Text only
1
2025-04-03T15:26:56
True
False
False
Jan 21, 2017 at 01:01 AM
/api/public/snipt/9/
hidden-input
<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>Html::activeHiddenInput($model, 'group_id', ['value' => $group_id])
</span></pre></div>
</td></tr></table>
yii