Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

li.li lili21

🎯
Focusing
Block or report user

Report or block lili21

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lili21
lili21 / domtokenlist_feature_detection.js
Created Feb 5, 2018 — forked from igrigorik/domtokenlist_feature_detection.js
DOMTokenList supports() example for Preload
View domtokenlist_feature_detection.js
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@lili21
lili21 / supportsES6.js
Created Dec 13, 2017 — forked from bendc/supportsES6.js
Test if ES6 is ~fully supported
View supportsES6.js
var supportsES6 = function() {
try {
new Function("(a = 0) => a");
return true;
}
catch (err) {
return false;
}
}();
@lili21
lili21 / LICENSE
Created Aug 29, 2017 — forked from rkirsling/LICENSE
Directed Graph Editor
View LICENSE
Copyright (c) 2013-2015 Ross Kirsling
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@lili21
lili21 / curry.js
Created Aug 19, 2017
infinite curry
View curry.js
function curry(fn) {
var _args = []
return function _fn (...args) {
_args = [..._args, ...args]
if (args.length) {
return _fn
} else {
const r = _args.reduce(fn)
_args = []
return r
@lili21
lili21 / co.js
Last active Aug 14, 2017
generator, promise.
View co.js
function co (_g) {
const ge = _g()
next(ge)
}
function next(ge, _v) {
const { value, done } = ge.next(_v)
if (done) {
ge.next(value)
} else {
@lili21
lili21 / rx.js
Last active Aug 14, 2017
observable
View rx.js
const observer = {
next: function nextCb(data) {
console.log(data)
},
error: function errorCb(error) {
console.error(error)
},
complete: function completeCb(data) {
@lili21
lili21 / decorator-ng-di.js
Last active Aug 14, 2017
decorator-ng-di
View decorator-ng-di.js
@Inject('ServiceA', 'ServiceB', 'ServiceC')
class Ctrl {
fetchData () {
this.ServiceA.fetch()
}
}
function Inject (...args) {
return function (target, key, descriptor) {
const ctrl = function (..._args) {
args.forEach((v, i) => {
View precommit-eslint
git diff --name-only --cached --relative | grep '\\.js$' | xargs eslint
View preload_feature_detection.js
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@lili21
lili21 / gist:5bf6960d32b51db3922269eca1b2130b
Created Jan 11, 2017 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
View gist:5bf6960d32b51db3922269eca1b2130b
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
You can’t perform that action at this time.