This file contains hidden or 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
## | |
# test/spec/mini 5 | |
# http://gist.github.com/307649 | |
# [email protected] | |
# | |
def context(*args, &block) | |
return super unless (name = args.first) && block | |
require 'test/unit' | |
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do | |
def self.test(name, &block) |
This file contains hidden or 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
# Tools > New Plugin | |
# Save as signature.py | |
import datetime, getpass | |
import sublime, sublime_plugin | |
class SignatureCommand(sublime_plugin.TextCommand): | |
def run(self, edit): |
This file contains hidden or 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 Preferences > Key Bindings - Default | |
# Add a new entry | |
{"keys": ["ctrl+alt+s"], "command": "signature" }, |
This file contains hidden or 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
h3 { | |
text-align:left; | |
padding:8px; | |
border-bottom:solid 2px #333; | |
font-weight:400; | |
font-size:18px; | |
padding:10px 20px; | |
background:#f4f4f4; | |
background:-webkit-gradient(linear,left top,left bottom,from(#f4f4f4),to(#e8e8e8)); | |
background:-moz-linear-gradient(top,#f4f4f4,#e8e8e8); |
This file contains hidden or 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
Show hidden characters
## Tools > New Plugin... | |
{ | |
"cmd": ["/path/to/script/run_rails_tests.rb", "$file"] | |
} |
This file contains hidden or 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
# Edit Rakefile in project root | |
# | |
# Add a new rake test task... E.g., rake test:lib, below everything else in that file... | |
# Alternatively, add a task in lib/tasks/ directory and plop in the same code | |
namespace :test do | |
desc "Test lib source" | |
Rake::TestTask.new(:lib) do |t| | |
t.libs << "test" | |
t.pattern = 'test/lib/**/*_test.rb' | |
t.verbose = true |
This file contains hidden or 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 | |
# crontab -e | |
# 10 3 * * * /root/mysql_backups.sh > ~/backups/status.log | |
# change DB_USER and DB_PASSWD as per configuration | |
export DB_BACKUP="~/domains/baks" | |
export DB_USER="******" | |
export DB_PASSWD="*****" | |
export DB_HOST="*****" |
This file contains hidden or 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
alias ll='ls -lha' | |
alias r='rails' | |
alias b='bundle' | |
alias reload!='rake db:drop && rake db:create && rake db:migrate && rake db:fixtures:load' | |
source ~/.git-completion.bash | |
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ \e[0;31m$ \e[0m' | |
export CLICOLOR=1 |
This file contains hidden or 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
# ERB YAML Template | |
def database_configuration | |
require 'erb' | |
YAML::load(ERB.new(IO.read(paths["config/database"].first)).result) | |
end | |
# HEREDOC Syntax | |
TEMPLATE = <<-HTML # :nodoc: |
This file contains hidden or 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
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |