This file contains hidden or 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 EmployerManager | |
attr_accessor :name, :increment_count, :industry, :linkedin_id | |
def initialize(name, increment_count = false) | |
@name, @increment_count = name, increment_count | |
@industry = nil | |
@linkedin_id = nil | |
end | |
def find_or_create |
This file contains hidden or 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 PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
This file contains hidden or 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
# I have the following: | |
# User (Doc) => goal_matches (Array) => Goal Match (Embedded Doc) | |
# Goal Match looks like this: | |
key :user_id, ObjectId | |
key :matches, Array | |
key :weight, Integer | |
key :matched_employers, Array |
This file contains hidden or 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 'spork' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' |
This file contains hidden or 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
# Imagine we have something like: | |
class User | |
include MongoMapper::Document | |
key :first_name, String | |
key :last_name, String | |
key :connections, Array | |
key :interests, Array | |
key :skills, Array |
This file contains hidden or 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 PhotoUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
storage :fog | |
process :resize_to_fit => [200, 200] | |
version :normal do | |
process :resize_to_fill => [100, 100] | |
end | |
This file contains hidden or 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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains hidden or 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 STATSD | |
################## | |
sudo apt-get install git-core python-software-properties build-essential | |
sudo apt-get -y install python-software-properties debhelper | |
sudo apt-add-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get -y install nodejs npm |
This file contains hidden or 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
$ rake db:test:prepare --trace | |
** Invoke db:test:prepare (first_time) | |
** Invoke db:abort_if_pending_migrations (first_time) | |
** Invoke environment (first_time) | |
** Execute environment | |
** Execute db:abort_if_pending_migrations | |
** Execute db:test:prepare | |
** Invoke db:test:load (first_time) | |
** Invoke db:test:purge (first_time) | |
** Invoke environment |
This file contains hidden or 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
irb(main):011:0> UserMailer.methods.include?(:delay) | |
=> true | |
irb(main):012:0> UserMailer.delay.new_message(11) | |
TypeError: can't dump anonymous class Class | |
from /Users/bhilkert/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:211:in `visit_Class' | |
from /Users/bhilkert/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept' | |
from /Users/bhilkert/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `block in visit_Array' | |
from /Users/bhilkert/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `each' | |
from /Users/bhilkert/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `visit_Array' | |
from /Users/bhilkert/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept' |