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
defmodule Factorial do | |
def factorial(n) when n>1 do | |
n * factorial(n-1) | |
end | |
def factorial(n) when n <=1 do | |
1 | |
end | |
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
van_glory = Game.new title: ‘Van Glory’ | |
fates = Game.new title: ‘Fates Forever’ | |
van_gloryless = Game.new title: ‘Van Glory’ | |
van_glory === van_glory # true | |
fates === van_glory # false | |
van_gloryless === van_glory # false |
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
def do_job | |
return if @cleaning | |
puts "Starting cleanup" | |
@cleaning = true | |
sleep(10) # simulate killing of sinatra app | |
puts "Completed" | |
exit | |
end | |
while true | |
trap('INT') { do_job } |
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
--color | |
--require spec_helper |
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
osascript -e 'tell application "Keyboard Maestro Engine" to do script "Keyboard International"' |
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
CREATE TABLE test ( | |
id serial NOT NULL primary key, | |
name text | |
desc1 text | |
desc2 text | |
); | |
CREATE INDEX alll ON test(name, desc1, desc2); | |
CREATE INDEX name ON test(name); | |
CREATE INDEX more ON test(name, desc1); | |
CREATE INDEX more1 ON test(name, desc2); |
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
class Item < ItemTemplate | |
self.primary_key = "id" | |
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
.container | |
.row | |
.col-md-4.col-md-offset-4 | |
.login-panel.panel.panel-default | |
.panel-heading | |
%h3.panel-title Sign up | |
.panel-body | |
%div | |
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| | |
= devise_error_messages! |
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
require 'capistrano/setup' | |
require 'capistrano/deploy' |
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
server { | |
listen 80; | |
root /var/www/app/current; | |
index index.php index.html index.htm; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ =404; |