Skip to content

Instantly share code, notes, and snippets.

Avatar
🎮

Chris Yip chrisyip

🎮
View GitHub Profile
View README.md
@chrisyip
chrisyip / ac.js
Created Jul 14, 2017
async vs co
View ac.js
'use strict'
console.log('Using node %s', process.versions.node)
function p () {
return Promise.resolve('hello').then(s => `${s} world`)
}
const a = async function () {
await p()
@chrisyip
chrisyip / aria2.conf
Created Jun 11, 2017
aria2 on R7500v2
View aria2.conf
# Aria2 configuration
# RPC Setting
enable-rpc=true
rpc-listen-all=true
rpc-allow-origin-all=true
rpc-listen-port=6800
rpc-secret=aria2_secret
# General Setting
View docs.json
[{"name":"Angular","slug":"angular~2_typescript","type":"angular","links":{"home":"https://angular.io/","code":"https://github.com/angular/angular"},"version":"2 TypeScript","release":"2.4.7","mtime":1487432703,"db_size":3380979},{"name":"Angular","slug":"angular~2_dart","type":"angular","links":{"home":"https://angular.io/","code":"https://github.com/angular/angular"},"version":"2 Dart","release":"2.2.4","mtime":1480870302,"db_size":3538959},{"name":"Angular.js","slug":"angularjs~1.6","type":"angularjs","version":"1.6","release":"1.6.3","mtime":1489347998,"db_size":1698263},{"name":"Angular.js","slug":"angularjs~1.5","type":"angularjs","version":"1.5","release":"1.5.11","mtime":1487432576,"db_size":1668313},{"name":"Angular.js","slug":"angularjs~1.4","type":"angularjs","version":"1.4","release":"1.4.14","mtime":1476633905,"db_size":1444683},{"name":"Angular.js","slug":"angularjs~1.3","type":"angularjs","version":"1.3","release":"1.3.20","mtime":1469290315,"db_size":1313532},{"name":"Angular.js","slug":"angul
@chrisyip
chrisyip / .zshrc
Created Mar 14, 2017
Zsh: auto run `nvm use` if `.nvmrc` exists
View .zshrc
function auto_nvm () {
if command -v nvm >/dev/null && [[ -a .nvmrc ]]; then
nvm use
fi
}
chpwd_functions=(${chpwd_functions[@]} "auto_nvm")
auto_nvm
@chrisyip
chrisyip / promised_sentry_capture_error.js
Created Dec 14, 2016
A promise version of Sentry.captureError.
View promised_sentry_capture_error.js
'use strict'
const Raven = require('raven')
exports.capture = function (err, options = {}) {
return new Promise((resolve, reject) => {
const client = new Raven.Client(RAVEN_DSN)
const listener = res => {
@chrisyip
chrisyip / README.md
Created Nov 13, 2016
Vue v2 helpful plugins
View README.md
Vue.components('my-component', {
  ready () {
    this.doSomething()
  }
})

equals

Vue.components('my-component', {
View html-tags.json
[
"a",
"abbr",
"address",
"area",
"article",
"aside",
"audio",
"b",
"base",
View is-element-in-view.js
/**
* Detect if element is in view
*
* @method isElementInView
* @param {HTMLElement} element the target element
* @param {HTMLElement} [parentElement] container element, default is widnow
* @param {Boolean} [ignoreBottom] useful when element is taller than container
* @return {Boolean} element is in view or not
*/
function isElementInView (element, parentElement, ignoreBottom) {
View mpv.conf
# video playback
vo=opengl-hq:icc-profile-auto
autofit-larger=95%x90%
autofit-smaller=30%x30%
# tries to automatically enable hardware decoding
hwdec=auto
# osd message, you can press o to display the osd message
osd-bar-align-y=0.9
osd-bar-h=1.2