Skip to content

Instantly share code, notes, and snippets.

View shawjia's full-sized avatar
🎯
Focusing

shawjia

🎯
Focusing
  • Shenzhen, China
View GitHub Profile
@shawjia
shawjia / gist:71e4b29ae51c6519e5ab
Last active August 29, 2015 14:25 — forked from mgmilcher/gist:5eaed7714d031a12ed97
Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X

This is my take on how to get up and running with NGINX, PHP-FPM, MySQL and phpMyAdmin on OSX Yosemite.

This article is adapted from the original by Jonas Friedmann. Who I just discovered is from Würzburg in Germany. A stonesthrow from where I was born ;)

Xcode

Make sure you have the latest version of XCode installed. Available from the Mac App Store.

Install the Xcode Command Line Tools:

xcode-select --install

@shawjia
shawjia / label.js
Created June 8, 2012 02:39
label in JavaScript
test1: {
console.log(1);
console.log(2);
console.log(3);
break test1;
// 下面的代码不会执行
console.log(4);
console.log(5);
}
@shawjia
shawjia / prime.js
Created June 8, 2012 03:01
find prime
// find prime, example from Web Workers
var n = 1,
i,
q;
search: while (true) {
n += 1;
for (i = 2, q = Math.sqrt(n); i <= q; i++) {
if (n % i === 0) {
continue search;
@shawjia
shawjia / gist:2904467
Created June 10, 2012 08:21
分享到饭否 Bookmarklet 旧版
javascript:var d=document,w=window,f='http://fanfou.com/share',l=d.location,e=encodeURIComponent,p='?u='+e(l.href)+'&t='+e(d.title)+'&d='+e(w.getSelection?w.getSelection().toString():d.getSelection?d.getSelection():d.selection.createRange().text)+'&s=bm';a=function(){if(!w.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=0,width=600,height=400'))l.href=f+'.new'+p};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}void(0)
@shawjia
shawjia / ywqs.sh
Created July 18, 2012 15:53
批量下载 Linux 运维趋势
#!/usr/bin/env sh
# http://os.51cto.com/down/?dir=linuxops
wget -nc http://os.51cto.com/{os,down}/linuxops/{pdf/,}51cto_linuxops_issue{20..1}.{pdf,epub,mobi}
@shawjia
shawjia / apache_proxy.conf
Created November 15, 2012 07:50
Apache 转发请求
# http://httpd.apache.org/docs/2.4/mod/mod_proxy.html
<VirtualHost *:80>
ServerName www.test.com
ServerName test.com
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>
@shawjia
shawjia / web_snapshot.coffee
Created December 4, 2012 06:35
simple script to save web page as a png file
###
simple script to save web page as a png file
example:
phantomjs web_snapshot.coffee http://m.wikipedia.org/wiki/Special:Random
###
page = require('webpage').create()
system = require 'system'
@shawjia
shawjia / CentOS.md
Created December 13, 2012 09:54
Notes on CentOS

服务器为啥都用 CentOS?

我希望你能告诉我...

大力神丸 EPEL

CentOS 软件源东西太少了,yum install xx 时一堆No package jaljl available还是用这个吧。。 链接

@shawjia
shawjia / Cakefile
Created December 16, 2012 04:21
Cakefile Sample: morning
###
http://coffeescript.org/#cake
`cake -n jia morning`
###
option '-n', '--name [NAME]', 'name to say morning to'
task 'wake', 'Wake up', ->
console.log 'Time to wake up'
@shawjia
shawjia / forever-CoffeeScript-App.md
Created December 16, 2012 06:36
use forever to deploy Node.js App which is written in CoffeeScript

Solutions

it's quite simple.

forever start -c coffee app.coffee