This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker ps --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| uniq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(Recognition,c){ | |
var recognition = new Recognition; | |
recognition.lang = 'en-US'; | |
recognition.interimResults = false; | |
recognition.maxAlternatives = 5; | |
recognition.start(); | |
c.log('listening now'); | |
function triggerEvent(elem, Event, type) { | |
var event = new Event(type, {'bubbles': true, 'cancelable': true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Usage Example: serv home.html 5050 | |
## 2nd and 3rd arguments are optional | |
serv() { | |
open -a "Google Chrome" http://localhost:${2:-2020}/${1:-} | |
/usr/bin/php -S localhost:${2:-2020} -t . | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"mfacenet/hello-world": "v1.*" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
DB::listen(function ($sql) { | |
$log = vsprintf('[SQL] - ' . str_replace('?', '"%s"', $sql->sql), $sql->bindings); | |
if( App::runningInConsole() ) { | |
print($log); | |
} else { | |
\Log::info($log); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fp(num) | |
{ | |
// Typecast the user input | |
num = parseInt(num) || 0; | |
// Don't accept if length is 1 | |
if( num < 10 ){ | |
throw new Error('You must pass a number of at least two digits'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<canvas id="can" width="800" height="800"></canvas> | |
<script> | |
var lol = [0.0, 0.0, 0.0, 0.0, 11.0, 12.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 15.0, 14.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.0, 16.0, 11.0, 0.0, 0.0, 0.0, 0.0, 9.0, 16.0, 16.0, 10.0, 0.0, 0.0, 0.0, 4.0, 16.0, 12.0, 16.0, 12.0, 0.0, 0.0, 0.0, 3.0, 10.0, 3.0, 16.0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 16.0, 14.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.0, 11.0, 0.0, 0.0]; | |
var img = []; | |
while( lol.length ){ img.push( lol.splice(0,8) ) } | |
var can = document.querySelector('#can'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import plistlib | |
class Grammar(object): | |
def __init__(self, grammar): | |
self._grammar = grammar | |
self.names = [] | |
self.includes = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$d1 = new DateTime('2016-04-12'); | |
$d2 = new DateTime('2016-04-16'); | |
$ar = [ | |
['name' => 'vinay', 'date' => new DateTime('2016-04-05')], | |
['name' => 'vinay', 'date' => new DateTime('2016-04-12')], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Pass it your string of latlong and it'll return a promise to come back with the locality, city. | |
* | |
* getCity('12.9715987,77.5945627').done(function(cityName){ | |
* $elem.val( cityName ) | |
* }); | |
* | |
* Info: jQuery is required for $.Deferred() and $.getJSON to work! | |
* Regardless of everything modify it as per your convenience :) | |
*/ |
NewerOlder