This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<tree id="0"> | |
<item child="1" id="0_0" text="D.R.01/2012 - Rang Undang-Undang Pengantaraan 2012 (Lulus) "> | |
<userdata name="myurl">#</userdata> | |
<item text="D.R.01/2012" id="0_0_1" child="0" im0="book_titel.gif" im1="book_titel.gif" im2="book_titel.gif"> | |
<userdata name="myurl">'http://www.parlimen.gov.my/files/billindex/pdf/2012/DR012012.pdf'</userdata> | |
</item> | |
<item text="Dibentang Pada :02/04/2012" id="0_0_2" child="0"/> | |
<item text="Dibentang Oleh :Y.B. Datuk Liew Vui Keong, Timbalan Menteri di Jabatan Perdana Menteri" id="0_0_3" child="0"/> | |
<item text="Disokong Oleh :Y.B. Datuk Abdul Rahim Bakri, Timbalan Menteri Pengangkutan" id="0_0_4" child="0"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: control (start|stop) service_shortname | |
# simple script by @arzumy | |
# I use this in my .bashrc | |
# | |
# alias start='~/scripts/control start ' | |
# alias stop='~/scripts/control stop ' | |
# | |
# Then I'll just type 'start mysql' to start mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def to_options(str) | |
str.gsub(/((\s|^)(\w+))(=)/i) {|v| ", :#{$3} #{$4}> "} | |
end | |
print to_options(STDIN.read) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in resource model | |
# def self.find_for_authentication(conditions={}) | |
# case ActiveRecord::Base.connection.adapter_name | |
# when 'PostgreSQL' | |
# find(:first, :conditions=>['UPPER(email) = ?', conditions[:email].upcase!]) | |
# else | |
# find(:first, :conditions => conditions) | |
# end | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cheapskate solution so that delayed_job only kicks off in production | |
# Useful when you can't pass the development delayed_job in heroku cost to client | |
Delayed::DelayProxy.class_eval do | |
def method_missing(method, *args) | |
performable = Delayed::PerformableMethod.new(@target, method.to_sym, args) | |
if RAILS_ENV == "production" | |
Delayed::Job.create({ | |
:payload_object => performable, | |
:priority => ::Delayed::Worker.default_priority | |
}.merge(@options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Textmate bundle command to change HTML attr to symbol | |
# I normally use this when working with html files from designer | |
# so line like this id="logo" class="left" converted to , :id => "logo", :class => "left" | |
def to_options(str) | |
str.gsub(/((\s|^)(\w+))(=)/i) {|v| ", :#{$3} #{$4}> "} | |
end | |
print to_options(STDIN.read) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\[\033[00m\]\u@\h\[\033[00m\]:\[\033[00m\]\w\[\e[1;35m\] \`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[00m\]$\[\033[00m\] " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sample test for friendly_id for app with same name | |
require File.expand_path(File.dirname(__FILE__) + './../test_helper') | |
class AppsControllerTest < ActionController::TestCase | |
fast_context "GET to show" do | |
setup do | |
@app_one = Factory(:iphone_app, :name => "Tweetie") | |
@app_two = Factory(:iphone_app, :name => "Tweetie") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit goes to Geoff Hankerson | |
# Original tutorial http://geoffhankerson.com/node/108 | |
# This is a short version just for personal reference | |
# 1. Create key | |
sudo rndc-confgen -a | |
# 2. Add zone in named.conf | |
sudo vim /etc/named.conf |
NewerOlder