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 getTransitionendEventName() { | |
if ('ontransitionend' in window) { | |
// Firefox 16+, IE 10+, Chrome 26+, Opera 12.1+, Safari 6.1+ | |
return 'transitionend'; | |
} else if ('onwebkittransitionend' in window) { | |
// Chrome 4+, Safari 3.1+ | |
return 'webkitTransitionEnd'; | |
} else if ('onmoztransitionend' in window) { | |
// Firefox 4+ | |
return 'mozTransitionEnd'; |
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
class Test { | |
constructor() { | |
this.processData({}).then((data) => { | |
console.log(data); | |
}) | |
} | |
async processData(data) { | |
data = await this.one(data); |
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
/** | |
* The lightest JS template engine ever! (And the most unsafe one) | |
* Only replaces variables inside {{ }} (without any escaping) | |
* @param {string} template | |
* @param {object} data | |
* @example | |
* tpl( | |
* '<div class="{{ classname }}">{{item.title}}</div>', | |
* { classname: 'ololo', item: { ad: 'zzz', title: 'afffa!!bazinga' } } | |
* ); |
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
/** | |
* The second lightest JS template engine! (And still so unsafe one) | |
* Only replaces variables inside {{ }} (HTML-escaped) and {{{ }}} (unescaped) | |
* Second lightest after the original https://gist.github.com/thybzi/1e46eb8b23c11d55752ae4ac89a1cd13 | |
* @param {string} template | |
* @param {object} data | |
* @returns {string} | |
* @example | |
* tpl2( | |
* '<div class="{{ classname }}">{{{ item.content }}}</div>', |
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
/** | |
* Convert cli-style arguments to reasonable key-value hashmap object | |
* @param {string[]} args Raw cli args | |
* @param {boolean} dropFirstTwo Useful for nodejs (drops two leading args) | |
* @returns Object<string|number|boolean> | |
* @example | |
* yargify(['--foo=bar', '--qux="hello world", '--fred', '-x=42', '-y=false']) | |
* // => {foo: 'bar', qux: 'hello world', fred: true, x: 42, y: false} | |
*/ | |
function yargify(args, dropFirstTwo=true) { |
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
/** | |
* @param {string} url | |
* @returns {Promise<string>} | |
* @private | |
*/ | |
async function _fetchRemote(url) { | |
const http = /^https:/.test(url) ? require('https') : require('http'); | |
return new Promise((resolve, reject) => { | |
http.get(url, res => { | |
res.setEncoding('utf8'); |
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 _patchFs() { | |
if (fs.hasOwnProperty('_mockedFiles')) { | |
return; | |
} | |
fs._readFileReal = fs.readFile; | |
fs._mockedFiles = {}; | |
fs.mockFile = function(filePath, fileContent) { | |
fs._mockedFiles[filePath] = fileContent; | |
}; | |
fs.readFile = function(filePath, cb) { |
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
source "https://rubygems.org" | |
# Hello! This is where you manage which Jekyll version is used to run. | |
# When you want to use a different version, change it below, save the | |
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: | |
# | |
# bundle exec jekyll serve | |
# | |
# This will help ensure the proper Jekyll version is running. | |
# Happy Jekylling! | |
# gem "jekyll", "~> 4.2.0" |
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
[user] | |
name = John Smith | |
email = jsmith@example.com | |
[color] | |
ui = auto | |
[alias] | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
co = checkout | |
[push] | |
default = tracking |
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
<?php | |
ini_set('user_agent', 'ThybziDiscogsClient/1.1 +http://thybzi.com/wishlist'); | |
define('BASE_URI', 'https://api.discogs.com/'); | |
define('API_TOKEN', 'YOUR_TOKEN_HERE'); // get one on https://www.discogs.com/settings/developers | |
define('CACHE_DIR', __DIR__ . '/../cache/'); | |
define('CACHE_LIFE', 24 * 60 * 60); | |
define('PER_PAGE', 100); | |
function getUriContent($uri) { |