This file contains hidden or 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
import * as crypto from 'crypto'; | |
import { OptionsInit, got } from 'got-scraping'; | |
export interface GotDigestAuthOpts { | |
password: string; | |
username: string; | |
} | |
export default class GotDigestAuth { | |
private count: number; |
This file contains hidden or 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
// Bulma to scss gulp script | |
// In your terminal | |
// 1. npm install -D sass-convert gulp bulma gulp-sass gulp-replace | |
// 2. gem install sass | |
var gulp = require("gulp"), | |
replace = require('gulp-replace'), | |
converter = require('sass-convert'), | |
sass = require('gulp-sass'); |
This file contains hidden or 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
const gulp = require('gulp'); | |
const zip = require('gulp-zip'); | |
gulp.task('default', () => | |
gulp.src(['**/settings/**/*.json', '**/run.js', '**/app/**/*.js', '**/node_modules/**/*','settings.job']) | |
.pipe(zip('YOUR_APP_NAME' + (new Date()).toJSON() + '.zip')) | |
.pipe(gulp.dest('')) | |
); | |
// 1.The script assumes your app have some settings stored as .json in a drawer named settings (remove if not, ofcourse). |
This file contains hidden or 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
// UPDATE: The types is ready. npm install @types/web-animation-js | |
// I leave this as an refference for the w3c specs | |
// I coldn't find any definition file. This is a work in progress and it's my first d.ts file so the gist will be updated. | |
// The latest spec and the latest web-animations-js polyfill isn't compatible, so I will try to make it more web-animations-js compatible. | |
interface DocumentTimelineOptions { | |
originTime: DOMHighResTimeStamp; | |
} | |
declare type FillMode = "none" | "forwards" | "backwards" | "both" | "auto"; | |
declare type IterationCompositeOperation = "replace" | "accumulate"; |
This file contains hidden or 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 isArray = Array.isArray || function(arg) { | |
return Object.prototype.toString.call(arg) === '[object Array]'; | |
}; | |
function isObject(o) { | |
return ((o !== null) && (typeof o === 'object') && !isArray(o)); | |
} | |
function jsonEqual(object1, object2) { | |
return JSON.stringify(object1) == JSON.stringify(object2); |
This file contains hidden or 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
module.exports = (function (w, prefixes, fnc) { | |
while (!fnc && prefixes.length) { | |
fnc = w[prefixes.pop() + 'equestAnimationFrame']; | |
} | |
return (fnc && fnc.bind(w)) || w.setImmediate || function (fnc) { setTimeout(fnc, 0); }; | |
})(window || global, ['webkitR', 'mozR', 'msR', 'oR', 'r']); |
This file contains hidden or 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'); | |
function arrayToProps(o){ | |
let props = Object.keys(o).forEach(p => { | |
if(o[p] instanceof Array){ | |
var a = o[p]; | |
delete o[p]; | |
a.forEach((e, i) => (o[p + "_" + i] = e)); | |
} | |
}); | |
return o; |
This file contains hidden or 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 promisewrapper(fn) { | |
return (...args) => { | |
return new Promise((resolve, reject) => { | |
args.push((error, body) => { | |
if (error) { | |
return reject(error); | |
} | |
return resolve(body); | |
}); | |
fn(...args); |
This file contains hidden or 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 p1 = { | |
x: 20, | |
y: 20 | |
}; | |
var p2 = { | |
x: 40, | |
y: 40 | |
}; |