-
Use a version control system that allows you to deploy exactly what you want to, not "everything up to and including a particular checkin", e.g., use Git, not Perforce.
-
Have a centralized admin user account on servers, but also have individual user accounts and make people log in using their individual and then sudo. This strategy provides a better audit trail than logging in directly to the cetnral admin account.
-
Don't build a job queue system from scratch using cron. There are so many better-behaved job queue systems in various languages.
- Cron can't schedule more than some maximum number of jobs in a single minute, so it may miss running some jobs.
- Cron can't re-run missed jobs, so you have to come up with a way yourself of identifying any missed jobs (either because of the above issue or because cron or the system was down) and running them.
-
Databases sometimes need to be versioned in ways besides ActiveRecord-type migrations. For example, if two code branches differ in the columns th
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
module PerfectBitsMath | |
def number_of_squares_in_interval( m, n ) | |
1 | |
end | |
end | |
module Math | |
extend PerfectBitsMath | |
end |
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
# Based on http://stackoverflow.com/questions/2339021/how-can-i-load-some-activerecord-models-from-a-yaml-file-and-save-them-to-the-db/ | |
seed_filepath = File.join( RAILS_ROOT, 'db', 'seeds.yaml' ) | |
config = YAML::load_file( seed_filepath ) | |
config.each { |pluralized_model_name, fixtures| | |
model_class = pluralized_model_name.singularize.constantize | |
# If you like leaping without looking: | |
# model_class.create( fixtures ) |
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
now = Time.now.to_a | |
if ( now[2] * 60 + now[1] ) * 60 + now[0] > START_TIME_IN_SECONDS then | |
# start whatever you wanted to start at this time | |
end |
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
#!/usr/bin/env ruby | |
require 'rexml/document' | |
def set_up_Growl | |
if `ps -ax | grep GrowlHelperApp\.app | grep -v grep` == '' then | |
system( 'open /Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app' ) | |
end | |
end |
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
import java.lang.reflect.Method ; | |
String className = "java.lang.Class" ; // or whatever class you're interested in | |
Class c = Class.forName( className ) ; | |
Method[] methods = c.getDeclaredMethods() ; | |
for ( Method m : methods ) | |
{ |
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
actionmenu install | |
applist install | |
apr-lib install | |
apt install | |
apt7 install | |
apt7-key install | |
apt7-lib install | |
apt7-ssl install | |
backgrounder install | |
base install |
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
env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql/lib/ --with-mysql-config=/usr/local/mysql/bin/mysql_config |
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
cd /Library/Preferences/SystemConfiguration | |
sudo rm com.apple.airport.preferences.plist com.apple.network.identification.plist | |
cd ~/Library/Preferences | |
rm com.apple.internetconfigpriv.plist com.apple.internetconfig.plist |
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_type=unit | |
test_class_name=active_record | |
rake test:${test_type}s TEST=test/${test_type}/${test_class_name}_test.rb |