Skip to content

Instantly share code, notes, and snippets.

View pzgz's full-sized avatar
🏠
Working from home

Leon Guan pzgz

🏠
Working from home
View GitHub Profile
@marshluca
marshluca / nginx.sh
Created August 15, 2010 10:23
/etc/init.d/nginx
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@dhrrgn
dhrrgn / pow_port.rb
Created April 8, 2011 21:20
Quickly and easily change the port that Pow is running on. This allows you too run Apache and Pow side-by-side (on different ports of course).
#!/usr/bin/env ruby
# Pow Port
#
# Quickly and easily change the port that Pow is running on. This allows
# you too run Apache and Pow side-by-side (on different ports of course).
#
# WARNING: This will OVERWRITE your ~/.powconfig file. If you have custom
# configurations in there, please back it up first.
#
@JeanMertz
JeanMertz / syntax_highlighting.py
Created April 18, 2011 08:39
Ruby on Rails syntax highlight switcher for Sublime Text 2
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()
@ericsaboia
ericsaboia / gist:994614
Created May 27, 2011 03:58
Changelog ActiveRecord:Base Rails 3.1
# ActiveRecord::Base#dup and ActiveRecord::Base#clone semantics have changed to closer match normal Ruby dup and clone semantics.
# Calling ActiveRecord::Base#clone will result in a shallow copy of the record, including copying the frozen state. No callbacks will be called.
# Calling ActiveRecord::Base#dup will duplicate the record, including calling after initialize hooks. Frozen state will not be copied, and all associations will be cleared. A duped record will return true for new_record?, have a nil id field, and is saveable.
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@innotekservices
innotekservices / jquery.spin.js
Created October 16, 2011 02:39
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
@xdite
xdite / gist:1391980
Created November 24, 2011 18:31
stackoverflow & reddit
module Order
module Ranking
def self.included(base)
base.extend(ClassMethods)
end
def update_r_ranking
t = self
t.r_ranking = Topic.calculate_ranking(t.pushes_count, t.created_at)
t.save(:validate => false)
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu