Skip to content

Instantly share code, notes, and snippets.

View steel1990's full-sized avatar
🐺
I may be slow to respond.

Steel.Liao steel1990

🐺
I may be slow to respond.
View GitHub Profile
@steel1990
steel1990 / easing.js
Created May 9, 2020 01:50 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: t => t,
// accelerating from zero velocity
easeInQuad: t => t*t,
// decelerating to zero velocity
function shuffle(array) {
var m = array.length, t, i;
// While there remain elements to shuffle…
while (m) {
// Pick a remaining element…
i = Math.floor(Math.random() * m--);
// And swap it with the current element.
var http = require('http');
var createHandler = require('github-webhook-handler');
var bl = require('bl');
var shell = require('shelljs');
var PUBLISH_TAG_REG = /^refs\/tags\/(publish.*)$/i;
module.exports = function (options) {
http.createServer(function (req, res) {
req.pipe(bl(function (err, data) {
@steel1990
steel1990 / version_compare.js
Created October 27, 2015 06:28 — forked from TheDistantSea/version_compare.js
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
function copyToClipboard( text ){
var copyDiv = document.createElement('div');
copyDiv.contentEditable = true;
document.body.appendChild(copyDiv);
copyDiv.innerHTML = text;
copyDiv.unselectable = "off";
copyDiv.focus();
document.execCommand('SelectAll');
document.execCommand("Copy", false, null);
document.body.removeChild(copyDiv);
[alias]
pom = push origin master
pu = pull --rebase origin master
st = status
co = checkout
br = branch
mg = merge
ci = commit
md = commit --amend
dt = difftool
var list = [{
name: 'base',
src: [],
filename: 'base.js',
dest: []
}];
var createJSTask = function (opt) {
gulp.task(opt.name, function () {
return gulp.src(opts.src)
.pipe(gulp.dest(opts.dest));
var doc = document;
var head = doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
var baseElement = head.getElementsByTagName("base")[0];
var currentlyAddingScript;
var loadJS = function (url, callback, charset) {
var node = doc.createElement("script");
charset = charset || 'utf-8';
node.charset = charset;
var onload = function (error) {
var x = [{x:49.25,y:27.05,rotation:0,scaleX:1,scaleY:1},{x:54.15,y:28.8,rotation:0,scaleX:1,scaleY:1},{x:56.05,y:29.7,rotation:-0.0008697509765625,scaleX:1,scaleY:1},{x:56.15,y:27.1,rotation:-0.500946044921875,scaleX:1.00006103515625,scaleY:1.00006103515625},{x:55.7,y:26.85,rotation:-1.0009307861328125,scaleX:1.000030517578125,scaleY:1.000030517578125},{x:41.75,y:23.35,rotation:0,scaleX:1,scaleY:1},{x:33.3,y:20.8,rotation:0,scaleX:1,scaleY:1},{x:30,y:20.55,rotation:0,scaleX:1,scaleY:1},{x:29.85,y:22.75,rotation:-1.00006103515625,scaleX:1,scaleY:1},{x:29.4,y:24.7,rotation:-1.975921630859375,scaleX:1.000030517578125,scaleY:1.000030517578125},{x:29.25,y:24.95,rotation:-1.2517547607421875,scaleX:1.0000152587890625,scaleY:1.0000152587890625},{x:29.35,y:24.45,rotation:-1.0009307861328125,scaleX:1.000030517578125,scaleY:1.000030517578125},{x:29.25,y:24.05,rotation:-1.99951171875,scaleX:1.0000457763671875,scaleY:1.0000457763671875},{x:29.65,y:23.15,rotation:-2.23785400390625,scaleX:1.0000457763671875,scaleY:1.0000457
var base64ToBlobURL = function(base64, cb) {
base64 = base64.split(',');
var binary = atob(base64[1]);
var len = binary.length;
var buffer = new ArrayBuffer(len);
var view = new Uint8Array(buffer);
for (var i = 0; i < len; i++) {
view[i] = binary.charCodeAt(i);
}
var blob = new Blob([view], { type: base64[0].split(':')[1].split(';')[0] });