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
$('img#spinner').hide(); | |
// Sort products by size selected from dropdown | |
$('form select#size').change(function() { | |
$('img#spinner').show(); | |
var size = $("select#size").val(); | |
if ($.getUrlVar('keywords')) { | |
var keywords = $.getUrlVar('keywords'); | |
var url = "/products?size=" + size + "&keywords=" + keywords + " ul.product-listing"; |
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
source ~/.git-completion.bash | |
#Prompt shows user, working directory, and branch if its a git repo | |
PS1='\h:\w$(__git_ps1 "(%s)") $ ' | |
# maintains a jump-list of the directories you actually use | |
export JPY=/Users/bcalloway/scripts/j.py # tells j.sh where the python script is | |
. /Users/bcalloway/scripts/j.sh # provides the j() function | |
alias jl='j -l' | |
alias jt='j -t recent' |
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 ApplicationController < ActionController::Base | |
helper :all | |
protect_from_forgery | |
filter_parameter_logging :password, :password_confirmation | |
helper_method :current_user_session, :current_user, :role_call | |
before_filter :start_session |
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 CreateImports < ActiveRecord::Migration | |
def self.up | |
create_table :imports do |t| | |
t.string :datatype | |
t.integer :processed, :default => 0 | |
t.string :csv_file_name | |
t.string :csv_content_type | |
t.integer :csv_file_size | |
t.timestamps | |
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
#!/bin/sh | |
# | |
# Sync's the following dirs to S3 using s3sync.rb | |
# /public/uploads | |
# /etc | |
# /usr/local/ec2onrails | |
# | |
export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXX | |
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
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
mysql> update user set password=PASSWORD('') where user='root'; | |
Query OK, 2 rows affected (0.03 sec) | |
Rows matched: 2 Changed: 2 Warnings: 0 | |
mysql> flush privileges; | |
Query OK, 0 rows affected (0.02 sec) | |
mysql> exit | |
Bye |
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
# via http://jimneath.org/2010/06/10/calculating-an-images-orientation-using-paperclip/ | |
class Image < ActiveRecord::Base | |
# Paperclip | |
has_attached_file :file | |
# Callbacks | |
before_create :set_orientation | |
protected |
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
<?php | |
//test database connection | |
// Address error handling. | |
ini_set ('display_errors', 1); | |
error_reporting (E_ALL & ~E_NOTICE); | |
// Attempt to connect to MySQL | |
if ($dbc = mysql_connect ($host, $user, $pass)) { |
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 t1.* | |
FROM table1 AS t1 | |
JOIN (SELECT col1 | |
FROM table1 | |
GROUP BY col1 | |
HAVING count(col1) > 1) AS t2 ON t1.col1 = t2.col1 | |
(where col1 is the column containing the duplication) |