Skip to content

Instantly share code, notes, and snippets.

@chrisyip
chrisyip / ac.js
Created July 14, 2017 04:20
async vs co
'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 June 11, 2017 15:12
aria2 on R7500v2
# 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
[{"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 March 14, 2017 10:27
Zsh: auto run `nvm use` if `.nvmrc` exists
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 December 14, 2016 07:00
A promise version of Sentry.captureError.
'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 November 13, 2016 18:47
Vue v2 helpful plugins
Vue.components('my-component', {
  ready () {
    this.doSomething()
  }
})

equals

Vue.components('my-component', {
[
"a",
"abbr",
"address",
"area",
"article",
"aside",
"audio",
"b",
"base",
/**
* 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) {
# 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