Skip to content

Instantly share code, notes, and snippets.

Ibrahim Muhammad whistler

Block or report user

Report or block whistler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jquery-hover-opacity.js
<script type="text/javascript">
jQuery(function(){
jQuery('#content div.portfolio,#content div.portfolio-small').hover(function(){
jQuery(this).find('img').fadeTo("fast", 0.5);
}, function(){
jQuery(this).find('img').fadeTo("fast", 1.0);
});
});
</script>
@whistler
whistler / install_vim+ruby
Created Sep 6, 2011
Install vim with ruby support in lion using macports
View install_vim+ruby
sudo port install mercurial
hg clone https://vim.googlecode.com/hg/ vim
./configure --prefix=/my/install/prefix --enable-rubyinterp --enable-gui=no --disable-gpm
make
sudo make install
## tested on lion
## more info: http://nerderati.com/2010/07/compiling-vim-with-ruby-integration-on-snow-leopard/
@whistler
whistler / download_file.rb
Created Sep 18, 2011
Download and Save File using Ruby
View download_file.rb
#smallest, cleanest code i have seen without curl
require 'open-uri'
open("http://someplace.com/somefile.mp3") do |in_io|
File.open("somefile.mp3", 'w') do |out_io|
out_io.print in_io.read
end
end
@whistler
whistler / thumbnail.css
Created Dec 1, 2011
grayscale img with css crossbrowser
View thumbnail.css
a.a-thumb {
border: 1px solid black;
position: relative;}
a.a-thumb img {
width: 60px;
height: 60px;
border: 0;}
a.a-thumb span {
background-color: #000000;
position: absolute;
View star.css
Taken from: http://www.joseairosa.com/2009/07/24/easy-css-star-rating-layout/
Images: http://www.joseairosa.com/wp-content/uploads/2009/07/stars.png
http://www.joseairosa.com/wp-content/uploads/2009/07/stars_full.png
.classification {
position: relative;
width: 91px;
height: 17px;
}
.classification .cover {
@whistler
whistler / file_read_line_by_line.rb
Created Feb 28, 2012
Read file line by line in ruby
View file_read_line_by_line.rb
IO.foreach("filename.ext") { |line| p line}
@whistler
whistler / scrollToDiv.js
Created Apr 12, 2012
Scroll div into view
View scrollToDiv.js
document.getElementById('youridhere').scrollIntoView();
@whistler
whistler / rubyplusplus 12-17-2011
Created May 1, 2012
Set up Ubuntu for Rails and Github
View rubyplusplus 12-17-2011
############ For Vitual Machines #######
sudo locale-gen en_CA.UTF-8
sudo apt-get install ruby git build-essential
############ Run Updates ############
sudo apt-get update
sudo apt-get -y upgrade
############ Reboot ############
@whistler
whistler / run_tests.sh
Created Jun 6, 2012
Pull Rails application and test repeatedly
View run_tests.sh
#!/bin/bash
while [ true ]; do
git pull origin master
bundle install
rake db:migrate
rake rake:test:prepare
rake spec
done
@whistler
whistler / no_timestamps_in_json.rb
Created Jun 11, 2012
Dont send timestamps of Rails records to browser
View no_timestamps_in_json.rb
class ActiveRecord::Base
def as_json(options={})
super(:except => [:created_at, :updated_at])
end
end
You can’t perform that action at this time.