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
Host heroku.com | |
HostName heroku.com | |
User git | |
IdentityFile ~/.ssh/heroku.identity | |
IdentitiesOnly yes |
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
#Execute all of these commands starting at your root. you can type: cd ~ to make sure you are there | |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bash_profile # Mac OS X runs .bash_profile not .bashrc each time a new terminal window is opened. | |
. ~/.bash_profile | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # this takes a couple of minutes |
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 'rake/clean' | |
HAML = FileList['**/*.haml'] | |
LESS = FileList['**/*.less'] | |
COFFEE = FileList['**/*.coffee'] | |
HTML = HAML.ext('html') | |
CSS = LESS.ext('css') | |
JS = COFFEE.ext('js') |
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
## | |
# Inside: Rails.root/config/compass.rb | |
if Rails.env.production? | |
css_dir = "tmp/stylesheets/compiled" | |
else | |
css_dir = "public/stylesheets/compiled" | |
end | |
## | |
# Inside: Rails.root/config/initializers/compass.rb |
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
def gravatar_url(email,options = {}) | |
require 'digest/md5' | |
hash = Digest::MD5.hexdigest(email) | |
url = "http://www.gravatar.com/avatar/#{hash}" | |
options.each do |option| | |
option == options.first ? url+="?" : url+="&" | |
key = option[0].to_s | |
value = option[1].to_s | |
url+=key + "=" + value | |
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
#lib/tasks/cron.rake | |
desc "This task is called by the Heroku cron add-on" | |
task :cron => :environment do | |
if Time.now.hour == 0 # run at midnight | |
Person.create_schedule | |
puts "Finished running my first CRON task" | |
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
#models/person.rb | |
class Person < ActiveRecord::Base | |
def self.create_schedule | |
@people = Person.find(:all) | |
time_increment = 1 #Starts the first scheduled task for 1 minute from now. | |
@people.each do |person| |
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
# models/scheduler.rb | |
require 'httparty' | |
require 'pp' | |
MOMENT_API_KEY = 'XXXXXXXXXXXXX' | |
class Scheduler | |
include HTTParty | |
base_uri 'https://momentapp.com' |
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
# controllers/custom_controller.rb | |
class CustomController < ApplicationController | |
def index | |
Person.create_schedule | |
end | |
def mycustomaction | |
#Do Something with the user_id |
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
# config/routes.rb | |
MyApp::Application.routes.draw do | |
resources :people | |
resources :custom | |
resources :custom do | |
member do | |
get 'mycustomaction' |