Skip to content

Instantly share code, notes, and snippets.

View kany's full-sized avatar

Frank Kany kany

  • Rickman, TN
View GitHub Profile
@kany
kany / resque.rake
Created September 11, 2013 18:14 — forked from denmarkin/resque.rake
# 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}..."
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
@kany
kany / foreign_keys
Created March 4, 2013 18:51
Find Foreign Keys - Mysql
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';
@kany
kany / Look for items hogging disk space on Mac
Last active December 11, 2015 20:59
Look for items hogging disk space on Mac
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 *
@kany
kany / Reset MySQL 'root' user password
Last active December 11, 2015 20:58
Reset MySQL 'root' user password
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;
@kany
kany / Search Git Logs
Last active December 10, 2015 23:49
Search Git Logs
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
@kany
kany / Taming Git
Last active December 10, 2015 23:39
Taming Git
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.
@kany
kany / airbrake.rb
Created October 26, 2015 19:43
Test Airbrake From Rails Development Environment
# 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
@kany
kany / yaml output rails console
Created December 13, 2012 19:26
Yaml Output in Rails Console
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
@kany
kany / ubuntu,rvm,crontab
Created November 5, 2012 01:24
ubuntu,rvm,crontab
http://www.wyliethomas.com/blog/2011/08/24/rvm-rake-and-cron-on-ubuntu/
RVM, Rake and Cron on Ubuntu
by admin on August 24th, 2011
Tennnngh! I read countless blog posts, tried numerous approaches that I found and rebuilt the server more than a couple times. And finally I found what the missing piece was for getting a rake command to run in cron with rvm.
Most of the results I found (on stackoverflow) flagged the solution as adding the path to your rvm in your line item in crontab. Something like /home/username/.rvm/gems/rake my_awesome_task… etc. I tried every variation of that I could think of and got the same results.
I dont use cron every day so this was a revelation to me. I found out that you can set variables, environment variables in your crontab file.