application.scss.erb - use <%= asset_path 'background.jpg' %>
on config/environments/production.rb
# Inspired by http://verboselogging.com/2010/07/30/auto-scale-your-resque-workers-on-heroku | |
module HerokuAutoscale | |
module Scaler | |
class << self | |
@@heroku = Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASS']) | |
def workers | |
@@heroku.info(ENV['HEROKU_APP'])[:workers].to_i | |
end |
require 'yaml' | |
class DatabaseYML | |
attr_accessor :project_name, :config | |
DEFAULT_OPTIONS = { | |
"adapter" => "mysql2", | |
"encoding" => "utf8", | |
"reconnect" => false, | |
"pool" => 5, |
<div id="swf_upload"> | |
<strong>New Upload:</strong> | |
<div id="browse"> | |
<%= raw s3_swf_upload_tag( | |
fileTypes: "*.csv", | |
queueSizeLimit: 1, | |
selectMultipleFiles: false, | |
onQueueEmpty: "window.uploader.queueEmpty();", | |
onFileAdd: "window.uploader.fileAdd(file);", | |
onUploadingStart: "window.uploader.uploadingStart();", |
COPY table (each, f_ing, column, here, please, this, is, important!) | |
FROM '/Users/jfgomez86/the_f_ing.csv' | |
WITH CSV HEADER; |
scope :inactive, lambda { | |
ids = User.joins(:posts) | |
.select("users.id, max(post.created_at)") | |
.group("users.id") | |
.having("max(posts.created_at) < ?", [30.days.ago]) | |
where(id: ids) | |
} |
SELECT username,fullname,email | |
INTO OUTFILE '/tmp/users.csv' | |
FIELDS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' | |
FROM users; |
class AccountsController < ApplicationController | |
before_filter :force_ssl | |
def new | |
end | |
def create | |
end |
$(function() { | |
WysiHat.Commands.promptLinkSelection = (function() { | |
if (this.linkSelected()) { | |
if (confirm("Remove link?")) | |
this.unlinkSelection(); | |
} else { | |
var value = prompt("Enter a URL", "http://www.google.com/"); | |
if (value) | |
this.linkSelection(value); | |
} |
require 'rubygems' | |
require 'open-uri' | |
require 'json' | |
require 'ostruct' | |
def get_graph_object(object_id) | |
graph_json = open("https://graph.facebook.com/#{object_id}").read | |
data_hash = JSON.parse(graph_json) | |
parsed_hash = parse_hash(data_hash) |