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
http://assets.en.oreilly.com/1/event/59/Fat%20Models%20Aren_t%20Enough%20Presentation.pdf | |
http://stackoverflow.com/questions/2822314/about-presenter-pattern-in-rails-is-a-better-way-to-do-it/2822836#2822836 | |
http://donttrustthisguy.com/2008/05/29/using-presenters-in-rails-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
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011 | |
* http://benalman.com/ | |
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ | |
(function($) { | |
var o = $({}); | |
$.subscribe = function() { | |
o.on.apply(o, arguments); |
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 'singleton' | |
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code | |
# invoked during a single request. | |
# | |
# Example: | |
# | |
# 1) Make sure this file is loaded in an initializer | |
# | |
# 2) Add the following to your application.rb in Rails3: |
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
namespace :server_db do | |
task :get, :roles => :app do | |
puts "This task is designed to get database from the server" | |
puts "Example: cap ENV server_db:get" | |
timestamp = Time.new.strftime("%Y-%m-%d-%H%M%S") | |
tmp_dir = '~/tmp' | |
db_name = "viclarity_#{rails_env}" | |
db_dump = "#{db_name}_#{timestamp}" | |
db_dump_gz = "#{tmp_dir}/#{db_dump}.gz" |
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
Install Java JDK 6.0 update 31 on Ubuntu 12.04 LTS | |
Introduction | |
The first question is why are we installing an old JDK. The answer is that Oracle JDK 6.0 update 31 is the JDK recommended by Cloudera when installing CDH4 (Cloudera Distribution Hadoop v4). | |
This is an update to an older version of this post. Mainly I have changed the JDK from 1.6.0_26 to 1.6.0_31 as this is the recommended JDK for CDH4 . | |
Install Java | |
I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS. |
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
# When an RSpec test like this fails, | |
# | |
# @my_array.should == [@some_model, @some_model2] | |
# | |
# RSpec will call inspect on each of the objects to "help" you figure out | |
# what went wrong. Well, inspect will usually dump a TON OF SHIT and make trying | |
# to figure out why `@my_array` is not made up of `@some_model` and `@some_model2` | |
# really really painful. | |
# | |
# This little module and technique helps get around that. It will redefine `inspect` |
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 'net/http' | |
def working_url?(url_str) | |
url = URI.parse(url_str) | |
Net::HTTP.start(url.host, url.port) do |http| | |
http.head(url.request_uri).code == '200' | |
end | |
rescue | |
false | |
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
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'" | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'" | |
sudo su - postgres -c "service postgresql stop" | |
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"' | |
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 'RMagick' | |
require 'capybara' | |
require 'launchy' | |
module Capybara::Recording | |
def start_recording | |
system "rm -f tmp/*" | |
end | |
def save_recording |
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
(function() { | |
"use strict"; | |
angular.module("editableModule", ['ng']).directive("editable", function($timeout) { | |
return { | |
restrict: "AE", | |
scope: true, | |
require:"ngModel", | |
link: function(scope, element, attrs, ngModel) { | |
element.editable({ |
OlderNewer