Skip to content

Instantly share code, notes, and snippets.

@kany
kany / Show Trailing Whitespace
Created May 1, 2012 16:33
Textmate2 - Show Trailing Whitespace
The following explains how to install the Whitespace Bundle for TextMate2.
1) mkdir -p ~/Library/Application\ Support/Avian/Bundles
2) cd ~/Library/Application\ Support/Avian/Bundles
3) git clone https://github.com/mads379/Whitespace.tmbundle.git
4) Open TextMate > Preferences
5) Create a Variable named 'Invalid' with a value of 'Red'(or whatever color you choose)
6) Restart TextMate
@kany
kany / iZoom.min.js
Created August 5, 2012 04:23
Image - Magnifying Glass - jQuery
consignment_items_controller.rb
def show
@consignment_item = ConsignmentItem.find(params[:id])
@magnified_images = ""
@consignment_item.images.each_with_index do |image, index|
@magnified_images += "jQuery('#magnifyimage_#{index}').iZoom();"
end
end
@kany
kany / gist:3640501
Created September 5, 2012 17:25
Importing Large MySQL Databases - Mac OS
1) Install Keka
http://www.kekaosx.com/en/
2) (optional) split your import file(http://www.webmaster-source.com/2011/09/26/how-to-import-a-very-large-sql-dump-with-phpmyadmin/)
3) Compress your sql dump file(s) into a 7z file using Keka.
4) From the terminal, run:
7z x -so backup_some_app_data.sql.7z | mysql -u root some_app_db
@kany
kany / gist:3658110
Created September 6, 2012 16:22
WTF MySQL! Eating up diskspace
How to clear all those 'mysql-bin.00000**' files from /usr/local/var/mysql:
1) mysql -u root
2) flush logs;
3) reset master;
DONE!
@kany
kany / gist:3714996
Created September 13, 2012 15:14
Git Repo changes ssh fingerprint - how to update your known_hosts file
1) Open known_hosts file and look for the invalid host
nano ~/.ssh/known_hosts
2) Remove the line that has the invalid host. Should be the same host in your .git/config of your repo
ssh-keygen -R [dev.blahblah.com]:1234
3) Pull from repo
git pull
4) You should see something similar to this. Answer 'yes' when asked.
@kany
kany / unpack a gem
Created September 16, 2012 01:50
Unpacking a gem to a specific directory
Rhodes application stack needs required gem unpacked to the lib directory.
frankkany:rhodesprojects $ gem unpack mechanize --target ~/Desktop
Unpacked gem: '/Users/frankkany/Desktop/mechanize-2.5.1'
@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.
@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 / 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 / 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