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
1) rails c | |
2) YAML::ENGINE.yamler = 'syck' | |
3) y @user.participant | |
--- !ruby/object:Participant | |
attributes: | |
id: 9 | |
employee_hashed_ssn: "hashed ssn: 00001" | |
ch_member_id: 100 | |
first_name: Test Employee 00001 |
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
# Add 'config.development_environments = []' to config/initializers/airbrake.rb | |
Airbrake.configure do |config| | |
config.api_key = "1234" | |
config.environment_name = AppConfig.environment if AppConfig.environment | |
config.secure = true | |
config.development_environments = [] | |
end | |
# Test it out in the console | |
1) rails console |
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
Taming GIT | |
Using Git - and Git Flow | |
First up: Git for Agile Teams (pdf) should be considered required reading :) | |
Second, keep this diagram in mind while reading the following text (image source) | |
Git Flow | |
There is nothing special about Git Flow - everything is still commits, branches and tags, but the toolset does add some convenient shortcuts for common operations. Examples include making a hotfix for the current production version, and keeping track of multiple features under concurrent development. Git Flow does nothing special to commits, nor are the branches any different from branches you create by other means. A strict naming standard does make things easier to follow, though. |
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
Search git logs for tickets = 5803,5804,or5805 using regex. | |
http://gitready.com/advanced/2009/01/20/bend-logs-to-your-will.html | |
git log --grep=580[345] --stat -p --author=frank |
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
This method only works if currently logged in as root. Sometimes when working with older ruby 'mysql' gems, after the 'mysql' gem is installed, the previous password doesn't work. | |
1) Already logged into Mysql | |
2) gem jacked up your mysql password | |
3) mysql > use mysql; | |
4) mysql > UPDATE user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES; |
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
Change to root directory | |
1) cd / | |
See size of each file/folder in directory with sorting | |
2) sudo du -sh * | sort -gr | |
If /SomeFolder is over 1gb | |
3) cd SomeFolder && sudo du -sh * |
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 | |
concat(table_name, '.', column_name) as 'foreign key', | |
concat(referenced_table_name, '.', referenced_column_name) as 'references' | |
from | |
information_schema.key_column_usage | |
where | |
referenced_table_name is not null AND | |
referenced_table_name = 'org_units'; |
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
mkdir -p ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/CoffeeScript | |
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/CoffeeScript | |
curl -O https://raw.github.com/jashkenas/coffee-script-tmbundle/master/Syntaxes/CoffeeScript.tmLanguage | |
curl -O https://raw.github.com/jashkenas/coffee-script-tmbundle/master/Preferences/CoffeeScript.tmPreferences |
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
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version | |
# see https://github.com/defunkt/resque/issues/49 | |
# see http://redis.io/commands - new commands | |
namespace :resque do | |
desc "Clear pending tasks" | |
task :clear => :environment do | |
queues = Resque.queues | |
queues.each do |queue_name| | |
puts "Clearing #{queue_name}..." |
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
# Use raw sql to calculate distance between latitude/longitude coordinates | |
# From the web | |
# - http://gis.stackexchange.com/questions/31628/find-points-within-a-distance-using-mysql | |
"SELECT | |
id, ( | |
3959 * acos ( | |
cos ( radians(78.3232) ) | |
* cos( radians( lat ) ) | |
* cos( radians( lng ) - radians(65.3234) ) |