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
/** | |
* Synchronous version of Promise.always() | |
* @param {function(err:Error, data:any)} onResolveOrRejectFn | |
*/ | |
Promise.prototype.always = function(onResolveOrRejectFn){ | |
return this.catch(function(error){ | |
onResolveOrRejectFn(error); | |
throw error; | |
}).then(function(result){ | |
onResolveOrRejectFn(null, result); |
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
/** | |
* Fix memory leack for menu component and may be some other | |
*/ | |
$.Widget.prototype._classes = function( options ) { | |
var full = []; | |
var that = this; | |
options = $.extend( { | |
element: this.element, | |
classes: this.options.classes || {} |
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
if (!Object.assign) { | |
Object.assign = | |
function (target) { | |
var from, to = Object(target), symbols; | |
for (var s = 1; s < arguments.length; s++) { | |
from = Object(arguments[s]); | |
for (var key in from) { | |
if (Object.prototype.hasOwnProperty.call(from, key)) { | |
to[key] = from[key]; | |
} |
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
{ | |
"header": { | |
"number": { | |
"low": 0, | |
"high": 0, | |
"unsigned": true | |
}, | |
"previous_hash": "", | |
"data_hash": "223e57f14464047011a96d77eea75aa0296b25a10d50cdecf217948513644124" | |
}, |
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
// custom middleware: use res.promise() to send promise response | |
app.use((req,res,next)=>{ | |
/* | |
Report error | |
You can use it in severqal ways: | |
- promise.catch() from promise | |
- res.error(new Error()) - pass any error object | |
- res.error({status:401, message:'alala'}) - pass any object | |
- res.error(401, 'alala') - pass code and message separately |
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
# add next line in ~/.gitconfig | |
[alias] | |
forward = !git tag _temp && git checkout $1 --quiet && git merge _temp --ff-only && git tag _temp -d && git status | |
mergeto = !bash -x -c 'ish=$(git status |grep -P \"(HEAD detached at|On branch)\" | grep -oP \"[^ ]+$\" ) && echo "$ish" && git checkout '"$1"' --quiet && git merge "$ish" --no-ff --no-edit && git status' |
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
"use strict"; | |
/* global describe */ | |
/* global it */ | |
/* global require */ | |
/* jshint esversion: 6 */ | |
const assert = require('assert'); | |
/** | |
* |
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
$.fn.serializeObject = function() { | |
return this.serializeArray().reduce(function(result, item){ | |
result[item.name]=item.value; | |
return result; | |
}, {}); | |
}; |
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 assert = require('assert'); | |
/** | |
* Parse string date representation into Date object | |
* input string - date in ISO format: | |
* * "2018-05-17T16:40:56" | |
* * "2018-05-17T16:40:56.303Z" | |
* * "2018-05-17T16:40:56.303+00:00" |
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
git filter-branch \ | |
--prune-empty -d /dev/shm/scratch \ | |
--index-filter "git rm -rf --cached --ignore-unmatch oops.iso" \ | |
--tag-name-filter cat \ | |
-- --all |
OlderNewer