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 msWell(ms) { | |
return ~~((ms/1000)/3600)+'h'+~~(((ms/1000)%3600)/60)+'m'+~~((ms/1000)%60)+'s'; | |
} |
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
[ | |
{ | |
"url" : "https://github.com/nvbn/thefuck", | |
"title" : " nvbn/thefuck · GitHub", | |
}, | |
{ | |
"name" : "php", | |
"links" : [ | |
{ | |
"url" : "https://stackoverflow.com/questions/16496554/can-php-detect-4-byte-encoded-utf8-chars", |
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
var winner = ()=>{/*do what ever you want*/}; | |
var konami = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], | |
i = 0, | |
l = konami.length - 1; | |
(document).keyup(function(e){ | |
i = (konami[i] == e.keyCode) ? ((i == l) ? 0 && winner() : i + 1) : 0; | |
}); |
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
/* | |
highlight v3 !! Modified by Jon Raasch (http://jonraasch.com) to fix IE6 bug !! | |
Highlights arbitrary terms. | |
<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html> | |
MIT license. |
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
'use strict'; | |
var fs = require('fs'), | |
readline = require('readline'); | |
var ass_to_vtt = (file_in, file_out, cb)=>{ | |
var order = [], | |
gotOrder = false; | |
fs.writeFileSync(file_out, 'WEBVTT\n\n'); | |
readline.createInterface({ |
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
request.post(this.props.url) | |
.attach('file', file, file.name) | |
.on('progress', function(e){ | |
var elem = {name: file.name, pct: parseInt(e.percent).toString() + '%'}; | |
var current = this.state.uploading; | |
current[file.name] = elem; | |
this.setState({ uploading: current }); | |
}.bind(this)) | |
.on('error', function(err){ | |
var current = this.state.uploading; |
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
gource \ | |
-s .06 \ | |
-1280x720 \ | |
--auto-skip-seconds .1 \ | |
--seconds-per-day 0.1 \ | |
--multi-sampling \ | |
--stop-at-end \ | |
--key \ | |
--highlight-users \ | |
--hide mouse,progress \ |
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
'use strict'; | |
// Declare app level module which depends on views, and components | |
angular.module('appName', [ | |
... | |
'appName.socket' | |
]) |
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
// just launch node on this file. | |
/* | |
There is a lot to do here. | |
TODO: | |
-youtube-dl fail to write thumbnail to mp3 file. We need to do it by hand. | |
- display is ugly as fuck. SO: first create a data structure around spawned | |
processes. Including playlist rank, track rank, track intel, playlist intel. | |
Then build a "lib" to retrieve what's the outuput is talking about and insert it into | |
correct data structure. | |
then on events trigger display on correc data structure. |
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
-- from https://medium.com/hootsuite-engineering/recursively-merging-jsonb-in-postgresql-efd787c9fad7 | |
-- with unique array values merge | |
CREATE OR REPLACE FUNCTION jsonb_recursive_merge(A jsonb, B jsonb) | |
RETURNS jsonb LANGUAGE SQL AS $$ | |
SELECT | |
jsonb_object_agg( | |
coalesce(ka, kb), | |
CASE | |
WHEN va isnull THEN vb |