Skip to content

Instantly share code, notes, and snippets.

Twitter = function () {
// user credentials
var username, password;
function make_basic_auth(user, password) {
var tok = user + ':' + password;
var hash = Base64.encode(tok);
return "Basic " + hash;
}
return {
<div>
<div class="span-10 mLeft45">
<div>
<fieldset>
<legend>Sign in to Twitter</legend>
<p>
<label for="username">Username or email</label><br>
input type="text" id="username" name="username" class="title" (make this as HTML tag)
</p>
<p>
<div style="border-top:1px solid #404040">
<div style="color:#fff;;padding:10px">Welcome to Titanium</div>
</div>
namespace :save do
desc "it will create/generate route urls"
task :route_urls => :environment do
all_routes = ENV['CONTROLLER'] ? ActionController::Routing::Routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : ActionController::Routing::Routes.routes
routes = all_routes.collect do |route|
name = ActionController::Routing::Routes.named_routes.routes.index(route)
verb = route.conditions[:method]
segs = route.segments.inject("") { |str,s| str << s.to_s }
segs.chop! if segs.length > 1
reqs = route.requirements.empty? ? "" : route.requirements
git rebase -i A <sha>
git reset --soft HEAD^
git commit --amend
git rebase --continue
@rajib
rajib / .gitconfig
Created May 8, 2010 03:02
.gitconfig
# ADD LOCAL CONFIGURATION HERE
# DO NOT EDIT BELOW THIS LINE
[color]
diff = auto
status = auto
branch = auto
[core]
excludesfile = ~/.gitignore
def fetch_class(path)
current_page?(path) ? "class = 'current'" : ""
end
Example: <li <%= fetch_class(new_request_path) %>> text </li>
@rajib
rajib / recursive search file and delete..
Created April 30, 2010 08:55
recursive search file and delete..
find . -name "*.<file extention>"|xargs rm
@rajib
rajib / Evolution of a Ruby Programmer.rb
Created February 18, 2010 07:07 — forked from bernerdschaefer/Evolution of a Ruby Programmer.rb
Evolution of a Ruby Programmer.rb
# Newbie Programmer
def factorial(x)
if x == 0
return 1
else
return x * factorial(x - 1)
end
end
puts factorial(6)
puts factorial(0)
@rajib
rajib / generate slug
Created January 19, 2010 07:18
generate_slug.rb
class Post < ActiveRecord::Base
before_validation :generate_slug
def generate_slug
self.slug = self.title.dup if self.slug.blank?
self.slug.slugorize!
end
end
and in lib/core_extensions/string.rb