Skip to content

Instantly share code, notes, and snippets.

View lakshminarayanan's full-sized avatar

lakshminarayanan

View GitHub Profile
@lakshminarayanan
lakshminarayanan / development.rb
Created October 4, 2012 07:45
Disable colors in rails console
# disappear the annoying ANSI codes for PowerShell and cmd
if RUBY_PLATFORM =~ /mswin|mingw/i
ActiveSupport::LogSubscriber.colorize_logging = false
end
@lakshminarayanan
lakshminarayanan / gist:3832458
Created October 4, 2012 09:17
Bootstrap layout
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= content_for?(:title) ? yield(:title) : "Myapp" %></title>
<meta name="description" content="">
<meta name="author" content="">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
1 : I
2 : II
3 : III
4 : IV
5 : V
6 : VI
7 : VII
8 : VIII
9 : IX
10 : X
@lakshminarayanan
lakshminarayanan / application.css
Created October 5, 2012 05:56
Basic application styling
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
@lakshminarayanan
lakshminarayanan / application.html.erb
Created October 5, 2012 05:57
Basic application layout
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Flitter</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
ROMAN = [
["M" , 1000],
["CM" , 900],
["D" , 500],
["CD" , 400],
["C" , 100],
["XC" , 90],
["L" , 50],
["XL" , 40],
["X" , 10],
<h1> Log In</h1>
<%= form_tag sessions_path do %>
<div class="field">
<%= label_tag :name %> <br />
<%= text_field_tag :name, params[:name] %>
</div>
<div class="field">
<%= label_tag :password %> <br />
<%= password_field_tag :password, params[:password] %>
<div id="user_header">
<% if current_user %>
Logged in as <%= link_to current_user.name, user_path(current_user) %>
<%= link_to "Log out", logout_path %>
<% else %>
<%= link_to "Sign Up", signup_path %> or
<%= link_to "Log In", login_path %>
<% end %>
</div>
<br />
@lakshminarayanan
lakshminarayanan / seeds.rb
Created October 5, 2012 07:31
User Demo Data
User.delete_all
superman = User.create! name: "Superman", password: "superman"
superman.fleet "It's ok to be scared"
spiderman = User.create! name: "Spiderman", password: "spiderman"
spiderman.fleet "Your friendly neighbourhood spiderman"
spiderman.fleet "RT @greengoblin : No matter what you do for them, eventually, they will hate you"
terminator = User.create! name: "Terminator", password: "terminator"
@lakshminarayanan
lakshminarayanan / gist:3838918
Created October 5, 2012 09:29
Anagram test
require 'turn/autorun'
class AnagramTest < MiniTest::Unit::TestCase
def test_simple_match
assert 'ABBA'.anagram? 'BABA'
end
def test_non_match
refute 'ABBA'.anagram? 'BAB'
end