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() { | |
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); | |
} |
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
class AccountsController < ApplicationController | |
before_filter :force_ssl | |
def new | |
end | |
def create | |
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
SELECT username,fullname,email | |
INTO OUTFILE '/tmp/users.csv' | |
FIELDS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' | |
FROM users; |
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
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) | |
} |
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
COPY table (each, f_ing, column, here, please, this, is, important!) | |
FROM '/Users/jfgomez86/the_f_ing.csv' | |
WITH CSV HEADER; |
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
<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();", |
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 'yaml' | |
class DatabaseYML | |
attr_accessor :project_name, :config | |
DEFAULT_OPTIONS = { | |
"adapter" => "mysql2", | |
"encoding" => "utf8", | |
"reconnect" => false, | |
"pool" => 5, |
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
# 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 |
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
## | |
# 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 |
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
### | |
# Shortcut to projects directory: you can replace 'p' with your favorite word/character. | |
# Autocompleter enabled! Try: `p <tab>` ;) | |
# | |
PROJECTS_DIR="/Users/jfgomez86/Projects" | |
p() { | |
PROJECT_NAME="$1"; | |
cd "$PROJECTS_DIR/$PROJECT_NAME"; | |
} |