Skip to content

Instantly share code, notes, and snippets.

View fizzwu's full-sized avatar

Fizz fizzwu

  • NextStage
  • Suzhou, China
View GitHub Profile
@fizzwu
fizzwu / default.conf
Created August 5, 2016 08:12
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@fizzwu
fizzwu / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@fizzwu
fizzwu / preload associations with find_by_sql.rb
Last active August 29, 2015 14:06
preload associations with find_by_sql
# http://cha1tanya.com/2013/10/26/preload-associations-with-find-by-sql.html
# Rails4 way
@users = User.find_by_sql(some_condition)
ActiveRecord::Associations::Preloader.new.preload(@users, :company)
#!/bin/sh
echo "=== INIT UBUNTU RUBY ENV ==="
mkdir ~/temp
cd ~/temp
# Nginx
echo "=== Installing Nginx"
sudo apt-get -y update
sudo apt-get -y install curl git-core python-software-properties
add-apt-repository ppa:nginx/stable
#!/bin/sh
# Linux 自动备份 MySQL与网站并发邮件到自已邮箱
# 定义临时目录
BACKUP_PATH=/tmp/autobackups
# 定义日期字符串
DATE_NAME=`date +%y%m%d`
# 创建临时目录
mkdir $BACKUP_PATH
# 打包文件
@fizzwu
fizzwu / gist:4248240
Created December 10, 2012 03:36
戒指信息
@fizzwu
fizzwu / gist:3510438
Created August 29, 2012 10:50
Rails redirect back
session[:return_back] ||= request.referer
....
....
redirect_to session[:return_back]
@fizzwu
fizzwu / _config.yml
Created June 13, 2012 08:31
pagination in jekyll
# other config..
paginate: 10
@fizzwu
fizzwu / syntax_highlighting.py
Created May 25, 2012 08:31
Sublime Text 2自动匹配.rb文件ROR高亮脚本
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()