Let's say that we have a #container like this
<div id="container">
<div class="foo">Foo</div>
<div class="bar">Bar</div>
<div class="baz">Baz</div>
</div>| <?php | |
| /** | |
| * Take from https://gist.github.com/alixaxel/5562152 with some edits | |
| */ | |
| function slugify($string, $slug = '-', $extra = null) { | |
| if (strpos($string = htmlentities($string, ENT_QUOTES, 'UTF-8'), '&') !== false) { | |
| $string = html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|caron|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string), ENT_QUOTES, 'UTF-8'); | |
| } | |
| <?php namespace Tmb; | |
| use Illuminate\Database\Eloquent\Model as Eloquent; | |
| use Illuminate\Validation\Validator; | |
| class BaseModel extends Eloquent | |
| { | |
| /** | |
| * Error message bag |
| <?php | |
| class BlogController extends Controller | |
| { | |
| /** | |
| * Posts | |
| * | |
| * @return void | |
| */ | |
| public function showPosts() |
| <?php | |
| class BaseModel extends Eloquent { | |
| public $incrementing = false; | |
| protected $primaryKey = ['id', 'another_key']; | |
| public function save(array $options = []) | |
| { |
| package main | |
| import ( | |
| "strings" | |
| ) | |
| func IsOperator(c uint8) bool { | |
| return strings.ContainsAny(string(c), "+ & - & * & /") | |
| } |
| function h(s, f, t, e, c, r, m, l, p) { | |
| t = ''; | |
| p = []; | |
| e = function(t) { | |
| return (t.replace(/[<&]/g, function(c) { | |
| return '&#' + c.charCodeAt() + ';' | |
| })) | |
| }; | |
| c = function(_) { | |
| return (_ = s.replace(/^(\s*)(\/(\/.*|\*([^]*?\*\/|[^]*)))/, function(_, w, m) { |
| // array utils | |
| // ================================================================================================= | |
| const combine = (...arrays) => [].concat(...arrays); | |
| const compact = arr => arr.filter(Boolean); | |
| const contains = (() => Array.prototype.includes | |
| ? (arr, value) => arr.includes(value) | |
| : (arr, value) => arr.some(el => el === value) |
| function compressString(str) { | |
| const arrayOfChars = str.split('') | |
| let currentChar = arrayOfChars[0] | |
| let timeOfAppear = 1 | |
| const mapOfChars = arrayOfChars.slice(1).reduce((result, value, index) => { | |
| if (value === currentChar) { | |
| timeOfAppear++ | |
| return result |
| const splitChars = /\b(billion|million|thoudsand|hundred)s?/g | |
| const points = { | |
| billion: 1000000000, | |
| million: 1000000, | |
| thoudsand: 1000, | |
| hundred: 100 | |
| } | |
| const digits = { |