Skip to content

Instantly share code, notes, and snippets.

View adamgamble's full-sized avatar

Adam Gamble adamgamble

View GitHub Profile
# Make sure you do this from time to time:
sudo apt-get update && sudo apt-get upgrade -y
# Here are the actual packages (feel free to contribute):
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev nodejs libssl-dev libreadline6-dev libreadline-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev ncurses-term automake libtool bison subversion libcurl4-openssl-dev mysql-client mysql-server postgresql postgresql-contrib imagemagick libmagickwand-dev apache2-mpm-prefork apache2-prefork-dev libapr1-dev libaprutil1-dev redis-server vim -y
# Make default editor vim :)
echo "export EDITOR=vim" >> ~/.bashrc
# Install RVM
@adamgamble
adamgamble / Custom.css
Last active December 15, 2015 14:19 — forked from nixpulvis/Custom.css
body{-webkit-animation: spin 30s linear infinite;}
p:before {content: "Code in Ruby! ";}
body, p, body p, body div p {font-family: 'Comic Sans MS', cursive !important;}
html {-webkit-animation: rainbow 8s infinite;}
@-webkit-keyframes blur {
0% { -webkit-filter: blur(0px); }
49% { -webkit-filter: blur(0px); }
50% { -webkit-filter: blur(1px); }
51% { -webkit-filter: blur(0px); }
100% { -webkit-filter: blur(0px); }
class User < ActiveRecord::Base
# Added by Koudoku.
has_one :subscription
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
XronoSas::Application.routes.draw do
devise_for :users
# Added by Koudoku.
mount Koudoku::Engine, at: 'koudoku'
match 'pricing' => 'koudoku::subscriptions#index', as: 'pricing'
root :to => "koudoku::subscriptions#index"
end
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
module CommonSteps
module Login
extend ActiveSupport::Concern
def create_regular_user
regular_user = FactoryGirl.create(:user)
end
def create_refinery_user
FactoryGirl.create(:refinery_user)
region_hash = Hash.new {|h,k| Region.where(:title => "dummy_region").first }
region_hash["Af Region"] = Region.where(:title => "Africa").first
region_hash["Su Rugsapon"] = Region.where(:title => "Asia-pacific").first
region_hash["Mi Deets"] = Region.where(:title => "Canada").first
region_hash["To McAloon"] = Region.where(:title => "Europe").first
region_hash["Co Peavy"] = Region.where(:title => "Gulf-of-mexico").first
region_hash["Jo Limia"] = Region.where(:title => "Latin-america").first
region_hash["Mi Region"] = Region.where(:title => "Middle-east").first
region_hash["Ti Adams"] = Region.where(:title => "Russia-caspian").first
region_hash["Fa Salem"] = Region.where(:title => "Us-land").first
class MainTable < ActiveRecord::Base
def self.migrate_from_temp_table
ActiveRecord::Base.transaction do
ActiveRecord::Base.connection.execute("DROP TABLE backup_tables")
ActiveRecord::Base.connection.execute("SELECT * INTO backup_tables FROM main_tables")
ActiveRecord::Base.connection.execute("DROP TABLE main_tables")
#raise ActiveRecord::Rollback
ActiveRecord::Base.connection.execute("SELECT * INTO main_tables FROM temp_tables")
TempTable.destroy_all
end
class Fixnum
def is_palindromic?
self.to_s.reverse.to_i == self
end
end
palindromic_numbers = []
(100...999).each do |i|
(100...999).each do |g|
new_num = i * g
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script type="text/javascript">
<!--
window.location = "http://blogs.ncr.com/converged-multichannel-retailing/";
//-->