application.scss.erb - use <%= asset_path 'background.jpg' %>
on config/environments/production.rb
$(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); | |
} |
class AccountsController < ApplicationController | |
before_filter :force_ssl | |
def new | |
end | |
def create | |
end |
SELECT username,fullname,email | |
INTO OUTFILE '/tmp/users.csv' | |
FIELDS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' | |
FROM users; |
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) | |
} |
COPY table (each, f_ing, column, here, please, this, is, important!) | |
FROM '/Users/jfgomez86/the_f_ing.csv' | |
WITH CSV HEADER; |
<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();", |
require 'yaml' | |
class DatabaseYML | |
attr_accessor :project_name, :config | |
DEFAULT_OPTIONS = { | |
"adapter" => "mysql2", | |
"encoding" => "utf8", | |
"reconnect" => false, | |
"pool" => 5, |
# 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 |
## | |
# Find latest *n* tweets, but don't repeat tweets by users. | |
# Example: | |
# | |
# If we have the following table: | |
# | |
# id | user_id | created_at | |
# 1 | 1 | 3 days ago | |
# 2 | 2 | 3 days ago | |
# 3 | 1 | 2 days ago |