Skip to content

Instantly share code, notes, and snippets.

@dca
dca / gist:d7b35f926f5a6173c68885e7779229a9
Created September 28, 2018 10:14
git cleanup merged remote branch script
$ git push origin --delete $(git branch -r --merged origin/master | grep origin | egrep -v '>|master|develop' | cut -d/ -f2-)
// https://gist.github.com/schacon/942899#gistcomment-2338002
=============================== Coverage summary ===============================
Statements : 82.96% ( 3929/4736 )
Branches : 62.72% ( 577/920 ), 5 ignored
Functions : 78.3% ( 534/682 )
Lines : 82.23% ( 3096/3765 )
================================================================================
@dca
dca / Dockerfile
Created April 7, 2017 10:17
BioServerAPI
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y curl
# nodejs
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
#
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
RUN echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
module.exports = {
dashboarddistance: function(a, b, c, d, callback) {
var ds = 0;
var distance = require('google-distance');
distance.get({
index: 1,
origin: a + ',' + b,
destination: c + ',' + d
}, function(err, data) {
if (err) {
@dca
dca / Front-end-Developer-Interview-Questions-TC.md
Created November 20, 2015 16:51 — forked from hanksudo/Front-end-Developer-Interview-Questions-TC.md
Front-end-Developer-Interview-Questions - 前端工程師面試問題集(繁體中文版)

前端工程師面試問題集

@版本 2.0.0

譯注:此翻譯版,主要給不能流利的讀英文的人看,相關專有名詞還是保留原文。翻譯不好地方請協助pull request.

此repository包含了一些前端開發的面試問題,來審查一個有潛力的面試者。這並不是建議你對同一個面試者問上所有的問 (那會花費好幾小時)。從列表中挑幾個題目,應該就夠幫助你審查面試者是否擁有你需要的技能。

Rebecca MurpheyBaseline For Front-End Developers 也是一篇很棒且值得讀的文章在你開始面試之前。

@dca
dca / mongoose-debug.js
Created June 8, 2015 12:26
Enable Mongoose Debug Mode
/*
* mongoose 除錯模式
* */
if ( /mongoose/.test(process.env.DEBUG) ){
mongoose.set('debug', true);
}
@dca
dca / cache.example.com
Created January 13, 2015 15:16
Nginx - Cache & Resize
#keys_zone=cache1:100m 表示这个zone名称为cache1,分配的内存大小为100MB
#/usr/local/nginx/proxy_cache_dir/cache1 表示cache1这个zone的文件要存放的目录
#levels=1:2 表示缓存目录的第一级目录是1个字符,第二级目录是2个字符,即/usr/local/nginx/proxy_cache_dir/cache1/a/1b这种形式
#inactive=1d 表示这个zone中的缓存文件如果在1天内都没有被访问,那么文件会被cache manager进程删除掉
#max_size=10g 表示这个zone的硬盘容量为10GB
proxy_temp_path /usr/share/nginx/html/proxy_temp_dir 1 2;
proxy_cache_path /usr/share/nginx/html/proxy_temp_dir/cache1 levels=1:2 keys_zone=cache1:100m inactive=1d max_size=10g;
#!/bin/bash
repos=(
"/Users/rob/Library/Application Support/TextMate/Bundles/Git.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/Ruby.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/RubyAMP.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/Ruby Haml.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/ruby-sass.tmbundle"
"/Users/rob/Library/Application Support/TextMate/Bundles/ruby-shoulda.tmbundle"
@dca
dca / css_resources.md
Created March 22, 2014 14:25 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides