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
marko@harman:~$ sudo gem install rails | |
[sudo] password for marko: | |
Successfully installed activesupport-3.0.0 | |
Successfully installed i18n-0.4.1 | |
Successfully installed activemodel-3.0.0 | |
Successfully installed rack-1.2.1 | |
Successfully installed rack-mount-0.6.13 | |
Successfully installed tzinfo-0.3.23 | |
Successfully installed erubis-2.6.6 | |
Successfully installed actionpack-3.0.0 |
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
module App | |
module Middleware | |
class OmniAuthConfigurator | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
current_domain = env["SERVER_NAME"] || env["HTTP_X_FORWARDED_FOR"] | |
website = Website.find_by_domain(current_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
# Eg Given I am logged in as @mislav | |
# | |
Given /^I am logged in as @(\w+)$/ do |username| | |
visit "/login/#{username}" | |
@current_user = User.find_by_login(username) | |
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
# Source: http://codekata.pragprog.com/2007/01/kata_two_karate.html | |
# | |
# Method takes an integer search target and a sorted array of integers. | |
# It should return the integer index of the target in the array, or -1 | |
# if the target is not in the array. | |
# | |
# Test data: | |
def test_chop | |
assert_equal(-1, chop(3, [])) |
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
body { | |
background-color: #4B7399; | |
font-family: Verdana, Helvetica, Arial; | |
font-size: 14px; | |
} | |
a img { | |
border: none; | |
} |
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 make install | |
node cli.js install npm | |
npm info it worked if it ends with ok | |
npm info using npm@0.3.0 | |
npm info using node@v0.4.0-pre | |
npm info fetch http://registry.npmjs.org/npm/-/npm-0.2.17.tgz | |
npm info calculating sha1 /tmp/npm-1297247221156/1297247221156-0.8592270885128528/tmp.tgz | |
npm info shasum da3ef5c631a377a6df266a933c2e92d361bcd3a6 | |
npm info calculating sha1 /usr/local/lib/node/.npm/.cache/npm/0.2.17/package.tgz | |
npm info shasum 7aa61f06f35622cfc329b13dccaf3cae498c344c |
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
# Sad shvatam šta si mislio sa lokalnom promenljivom, | |
# ja sam doduše u vidu imao samo objekat. Konceptualno, | |
# moja ideja bi mogla da si implementira kao: | |
class Transformable | |
def transform(sym) | |
self = self.send(sym) # => SyntaxError: compile error - Can't change the value of self | |
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
# use this in a after "deploy:update_code" block | |
namespace :bundler do | |
task :create_symlink, :roles => :app do | |
shared_dir = File.join(shared_path, 'bundle') | |
release_dir = File.join(current_release, '.bundle') | |
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}") | |
end | |
task :bundle_new_release, :roles => :app do |
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
*filter | |
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0 | |
-A INPUT -i lo -j ACCEPT | |
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT | |
# Accepts all established inbound connections | |
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT |
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
# in your routes.rb: | |
# devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } | |
# | |
# and view: | |
# link_to("Connect to LinkedIn", user_omniauth_authorize_path(:linked_in)) | |
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | |
def linkedin | |
omniauth_hash = env["omniauth.auth"] |