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 timeOut = 0; | |
$('.button').on('mousedown', function(e) { | |
console.log('click'); | |
//start hold | |
var i = 0; | |
timeOut = setInterval(function(){ | |
console.log('hold for', i++); | |
}, 150); | |
}).bind('mouseup mouseleave', function(e) { |
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' | |
const Gamepad = { | |
API: { | |
controller: {}, | |
connect: (e) => { | |
Gamepad.API.controller = e.gamepad; | |
console.log('Gamepad (id:%d) connected:', e.gamepad.index, e.gamepad.id); | |
}, | |
disconnect: (e) => { |
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
@echo off | |
Set "Path=%~d0%~p0" | |
Set "MyProcess=KeyboardVisualizerVC.exe" | |
tasklist /NH /FI "imagename eq "%MyProcess%"" 2>nul |find /i "%MyProcess%" >nul | |
If not errorlevel 1 ( | |
taskkill /im "%MyProcess%" | |
) else ( | |
start "" "%Path%""%MyProcess%" |
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 freezeGif = function (img) { | |
return new Promise(function (resolve) { | |
var i = new Image(); | |
i.src = img; | |
i.onload = function () { | |
var c = document.createElement('canvas'); | |
var w = c.width = i.width; | |
var h = c.height = i.height; |
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
// EN:calculate a given number's multiplicative persistence | |
// FR:calculer la persistance multiplicative d'un nombre donné | |
// Start number | nombre de départ | |
var n = 277777788888899; | |
var y = n; | |
var pst = 0; | |
while (y >= 10 && isFinite(y)) { |
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 fs = require('fs'); | |
var zlib = require('zlib'); | |
// Read local subtitle, gunzip it, encode to base64 | |
var toUpload; // future gunzipped/base64 encoded string | |
var path = 'foo/bar.srt'; // path to subtitle | |
fs.readFile(path, function(err, data) { // read subtitle | |
if (err) throw err; // handle reading file error | |
zlib.deflate(data, function(err, buffer) { // gunzip it | |
if (err) throw err; // handle compression error |
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
/* merge2subs | |
* | |
* Resync subtitle with another sub's timecodes | |
* | |
* @file_tc is the file you extract timecodes from; | |
* @file_lines is the one you extract text from; | |
* | |
* both arguments are absolute path to SRT files | |
* | |
* @xpath is an absolute path to a directory, to save mixed.srt |
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 fs = require('fs'); | |
var async = require('async'); | |
var path = require('path') | |
var DEBUT = Date.now(); | |
var USER_INPUT = process.argv[2], | |
FOUND_BINARY, | |
PATH_TO_BINARY; |
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
//transcode .ass, .ssa, .txt to SRT | |
var convert2srt = function (file, ext, callback) { | |
var readline = require('readline'), | |
counter = null, | |
lastBeginTime, | |
//input | |
orig = /([^\\]+)$/.exec(file)[1], | |
origPath = file.substr(0, file.indexOf(orig)), |
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 sec2time(timeInSeconds) { | |
var pad = function(num, size) { return ('000' + num).slice(size * -1); }, | |
time = parseFloat(timeInSeconds).toFixed(3), | |
hours = Math.floor(time / 60 / 60), | |
minutes = Math.floor(time / 60) % 60, | |
seconds = Math.floor(time - minutes * 60), | |
milliseconds = time.slice(-3); | |
return pad(hours, 2) + ':' + pad(minutes, 2) + ':' + pad(seconds, 2) + ',' + pad(milliseconds, 3); | |
} |