CRUD = Create, Read, Update, Delete
$host = '127.0.0.1';
$dbname = 'test';
$username = 'root';
<label for="addressCountry">Country</label> | |
<select name="addressCountry"> | |
<option></option> | |
<optgroup label="North America"> | |
<option value="US">United States</option> | |
<option value="UM">United States Minor Outlying Islands</option> | |
<option value="CA">Canada</option> | |
<option value="MX">Mexico</option> | |
<option value="AI">Anguilla</option> | |
<option value="AG">Antigua and Barbuda</option> |
<div class="alert"> | |
{{ $slot }} | |
</div> |
# Usage: git total [OPTION...] | |
# | |
# Options: | |
# | |
# In theory, the command accepts all command line options supported by | |
# the "git log" command. In reality, however, only few commit-limiting | |
# options are useful. This includes: | |
# | |
# --author=PATTERN, --committer=PATTERN | |
# Displays the number of lines changed by a certain author. |
Table of Contents generated with DocToc
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
public function BannersActive() | |
{ | |
return $this->hasMany('App\Ad') | |
->where('user_id', $this->id) | |
->where('status', 1) | |
->get(); | |
} |
var groupBy = function(xs, key) { | |
return xs.reduce(function(rv, x) { | |
(rv[x[key]] = rv[x[key]] || []).push(x); | |
return rv; | |
}, {}); | |
}; | |
console.log(groupBy(['one', 'two', 'three'], 'length')); |
let sum = course.lessons | |
.map(l => l.contents) | |
.reduce((acc, val) => acc.concat(val), []) | |
.reduce((acc, val) => { | |
return acc + val.length | |
}, 0) |
Brian Cray's original, for Wordpress: | |
<?php | |
$mycontent = $post->post_content; // wordpress users only | |
$word = str_word_count(strip_tags($mycontent)); | |
$m = floor($word / 200); | |
$s = floor($word % 200 / (200 / 60)); | |
$est = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's'); | |
?> |