Skip to content

Instantly share code, notes, and snippets.

Avatar

Frank Kany kany

  • Rickman, TN
View GitHub Profile
@kany
kany / yaml output rails console
Created Dec 13, 2012
Yaml Output in Rails Console
View yaml output 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 / airbrake.rb
Created Oct 26, 2015
Test Airbrake From Rails Development Environment
View airbrake.rb
# 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 / Taming Git
Last active Dec 10, 2015
Taming Git
View 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 / Search Git Logs
Last active Dec 10, 2015
Search Git Logs
View 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 / Reset MySQL 'root' user password
Last active Dec 11, 2015
Reset MySQL 'root' user password
View 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 / Look for items hogging disk space on Mac
Last active Dec 11, 2015
Look for items hogging disk space on Mac
View 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 / foreign_keys
Created Mar 4, 2013
Find Foreign Keys - Mysql
View foreign_keys
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';
View coffeescript_bundle_for_sublime.sh
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
View 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}..."
@kany
kany / index.txt
Created Dec 30, 2015 — forked from gus/index.txt
Ruby/Clojure analogs
View index.txt
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation: