Skip to content

Instantly share code, notes, and snippets.

View malavbhavsar's full-sized avatar

Malav Bhavsar malavbhavsar

View GitHub Profile
@malavbhavsar
malavbhavsar / _flash.html.erb
Created October 1, 2012 04:07 — forked from potomak/_flash.html.erb
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@malavbhavsar
malavbhavsar / get_authors_names.rb
Created December 14, 2012 21:17
Simple code to get the authors' names of the gems used in the project. You can use it to create the credit list or thank you slide.
#Run following command in 'rails console' REPL loop
Gem.loaded_specs.values.map {|gem| puts "#{gem.name} #{gem.version} #{gem.authors}"}
require 'bundler/setup'
require 'mechanize'
require 'open-uri'
agent = Mechanize.new
# agent.set_proxy 'localhost', 3128
# login
agent.get('https://www.codeschool.com/users/sign_in') do |page|
result = page.form_with(:action => '/users/sign_in') do |form|
//l.sauer 2011, public domain
//returns a hash table with the word as index and frequency as value; good for svg / canvas -plotting or other experiments
//[:punct:] Punctuation symbols . , " ' ? ! ; : # $ % & ( ) * + - / < > = @ [ ] \ ^ _ { } | ~
var wordcnt = function(id){
var hist = {}, words = document.getElementById(id).innerText.split(/[\s*\.*\,\;\+?\#\|:\-\/\\\[\]\(\)\{\}$%&0-9*]/)
for(var i in words)
if(words[i].length >1 )
hist[words[i]] ? hist[words[i]]+=1 : hist[words[i]]=1;
return hist;
};
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".tags*",
"*.pyc",

Keybase proof

I hereby claim:

  • I am malavbhavsar on github.
  • I am malavbhavsar (https://keybase.io/malavbhavsar) on keybase.
  • I have a public key whose fingerprint is 4EEF 10C3 D4A9 85EA BE55 3C98 BA4A 81F4 F6F9 7991

To claim this, I am signing this object:

\xFF\xD8\xFF\xE0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xFF\xE2\x01\xD8ICC_PROFILE\x00\x01\x01\x00\x00\x01\xC8\x00\x00\x00\x00\x040\x00\x00mntrRGB XYZ \a\xE0\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00acsp\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\xF6\xD6\x00\x01\x00\x00\x00\x00\xD3-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\tdesc\x00\x00\x00\xF0\x00\x00\x00$rXYZ\x00\x00\x01\x14\x00\x00\x00\x14gXYZ\x00\x00\x01(\x00\x00\x00\x14bXYZ\x00\x00\x01<\x00\x00\x00\x14wtpt\x00\x00\x01P\x00\x00\x00\x14rTRC\x00\x00\x01d\x00\x00\x00(gTRC\x00\x00\x01d\x00\x00\x00(bTRC\x00\x00\x01d\x00\x00\x00(cprt\x00\x00\x01\x8C\x00\x00\x00<mluc\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\fenUS\x00\x00\x00\b\x00\x00\x00\x1C\x00s\x00R\x00G\x00BXYZ \x00\x00\x00\x00\x00\x00o\xA2\x00\x008\xF5\x00\x