Skip to content

Instantly share code, notes, and snippets.

View zakelfassi's full-sized avatar

Zak El Fassi zakelfassi

View GitHub Profile
# GIT Tricks.
Delete from git all deleted system files:
git rm $(git ls-files --deleted)
View deleted file:
git show HEAD^:path/to/file
git show $(git rev-list --max-count=1 --all -- foo)^:foo
@zakelfassi
zakelfassi / update_paperclip_attachements.rb
Created September 26, 2014 12:54
Move Paperclip attachements
# Assuming you had a model like this
#
# class Post
# has_attached_file :image, :path => ":rails_root/public/system/:attachment/:id/:style/:filename"
# end
namespace :paperclip do
desc "Recreate attachments and save them to new destination"
task :move_attachments => :environment do
@zakelfassi
zakelfassi / lastEdited.sh
Created February 15, 2016 17:45
Get Last 1000 edited files in Unix
find . -type f -printf '%T@ %p\n' | sort -n | tail -1000 | cut -f2- -d" "