This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 1.1.1 Lisp atoms | |
;; If a list is preceded by single quote, we are telling lisp interpreter to take it as it is | |
'(sachin | |
rahul | |
saurav | |
laxman) | |
;; If a list is not preceded by single quote, lisp interpreter treats first atom of the list as a function, | |
;; and passes all the remaining atoms as arguments to it, and returns result of the function | |
(+ 2 2) | |
'(this list has (list inside it)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-T | |
-d postgresql | |
def change_log(stream) | |
# send Rails logs to console | |
# 2.X | |
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
Object.const_set 'RAILS_DEFAULT_LOGGER', Logger.new(stream) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fake email id generator for Gmail | |
# These emails will come to real email id you have provided to this script | |
require 'csv' | |
def generate_fake_emails(email, count = 1) | |
result = [] | |
username, domain = email.split('@') | |
count.times do |c| | |
result << "#{username}+#{c+1}@#{domain}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "get Custom Domain name" do | |
it "gives custom domain name from the url" do | |
get_custom_domain("http://facebook.com").should == "facebook.com" | |
get_custom_domain("https://gist.github.com").should == "gist.github.com" | |
get_custom_domain("http://www.github.com").should == "github.com" | |
get_custom_domain("www.google.com").should == "google.com" | |
get_custom_domain("http://examplesitewww.com").should == "examplesitewww.com" | |
get_custom_domain("http://examplehttp.com").should == "examplehttp.com" | |
get_custom_domain("").should == "" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Rails code-reading activity @ Open Source Friday | |
** For understanding what we do day to day in a better way, | |
** We will open up Rails codebase, | |
** And will go through the code, | |
** To understand the structure of Rails, | |
** To learn what, where, how it works, | |
** To contribute back in terms of documentation and bug-fixes and features! | |
* Useful links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo | |
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key | |
sudo yum install jenkins | |
sudo service jenkins start/stop/restart | |
sudo service jenkins start | |
sudo usermod -s /bin/bash jenkins | |
sudo usermod -m /var/lib/jenkins jenkins | |
sudo su - jenkins | |
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled | |
vi /var/lib/jenkins/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Packages and modules are imported to the scope using the import statement. | |
# If you wanted just a particular object from a module/package you can use | |
# the from <module> import <object> | |
import sys | |
import requests | |
# There are no constants in Python, still we can use a naming convention to | |
# imply that to the user of a library. | |
BASE_URL = "https://api.github.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source $HOME/.bashrc | |
rvm use 1.9.3 | |
bundle install | |
read -d '' database_yml <<"EOF" | |
login: &login | |
adapter: "postgresql" | |
encoding: utf8 | |
username: "postgres" | |
password: "postgres" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fill out the form with company attributes | |
attributes = ['name', 'website', 'phone', 'address', 'country', 'state', 'city', 'zip'] | |
for attr in attributes | |
$("#company_#{attr}").val(company["#{attr}"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = ["Ruby", "Python", "Clojure"] | |
#=> ["Ruby", "Python", "Clojure"] | |
a.to_sentence | |
#=> "Ruby, Python, and Clojure" |