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
tell application "Terminal" | |
activate | |
do script with command "cd ~/my/development/directory" | |
do script with command "cd ~/my/development/directory && mate ." | |
do script with command "cd ~/my/development/directory && script/server" | |
do script with command "cd ~/my/development/directory && script/console" | |
do script with command "cd ~/my/development/directory && autotest" | |
end tell |
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
//---- SASS ---- | |
// common code | |
=column_size(!size, !padding=1%) | |
width = !size - !padding | |
padding: | |
right = !padding | |
=equal_width_columns(!count) |
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/ruby | |
require 'fileutils' | |
files = Dir['*.sql'] | |
files.each do |file| | |
p file | |
typestring = `file #{file}` | |
if !typestring.include? "ASCII" | |
output = `iconv -f UCS-2 -t UTF-8 #{file}` | |
File.open(file, "w") do |f| |
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
require 'fileutils' | |
include FileUtils | |
require 'pathname' | |
namespace :paperclip do | |
desc "Remove Paperclip attachment directories with no entity" | |
task :gc => :environment do | |
current_trash = ((Pathname.new trash) + (Pathname.new Time.now.strftime("%Y-%m-%d.%H:%M:%S"))).cleanpath | |
# This algorithm assumes that the attachments have a :path starting with "#{IMAGES_ROOT}/[class name]/:attachment/:id/" | |
# This matches my setup, but may not match yours. |
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 | |
# Merges the current branch into the specified branch after checking out that branch. | |
# Usage: | |
# git merge-into [branch] | |
# [branch] defaults to "master" if not specified | |
# "sprint" is my convenience library for handling external processes. |
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
class String | |
def &(value = nil, default = "") | |
value ? self + value.to_s : default.to_s | |
end | |
end | |
# Mostly for consistency; not terribly useful | |
class NilClass | |
def &(value = nil, default = "") | |
default.to_s |
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
require 'rubygems' | |
require 'shoulda' | |
class Hash | |
def with_defaults( default_blocks ) | |
new_hash = Hash.new do |hash, key| | |
value = default_blocks[key] | |
if value.respond_to? :call | |
value = value.call | |
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
class Numeric | |
def between( *values ) | |
low = values.min | |
high = values.max | |
[[low,self].max, high].min | |
end | |
end | |
require "test/unit" | |
require "shoulda" |
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
select | |
sk.name as LocalSchemaName, | |
sn.name as SynonymName, | |
sn.base_object_name as FullTargetName, | |
substring( sn.base_object_name, 2, charindex(']', sn.base_object_name) - 2) as LinkedServerName, | |
sv.data_source as RemoteServerName, | |
substring( | |
sn.base_object_name, | |
charindex('[', sn.base_object_name, 2) + 1, | |
charindex( |
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
public static void RegisterRoutes(RouteCollection routes) | |
{ | |
// Matches /Controller/ModelID (with an optional /Action) | |
routes.MapRoute( | |
"Details", | |
"{controller}/{id}/{action}", | |
new { action = "Details" } | |
); | |
// Matches /Controller; typically this represents a list of all models for a particular controller. |
OlderNewer