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 'aws-sdk' | |
Aws.config.update({ | |
region: 'REGION_CODE_HERE', | |
credentials: Aws::Credentials.new( | |
'ACCESS_KEY_ID_HERE', | |
'SECRET_ACCESS_KEY_HERE' | |
) | |
}) | |
bucket_name = 'BUCKET_NAME_HERE' |
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
-- See https://github.com/dimitri/pgloader/blob/master/pgloader.1.md for | |
-- connection string options. | |
LOAD DATABASE | |
FROM mysql://root@localhost/mydb | |
INTO postgresql:///mydb | |
WITH include drop, truncate, create tables, create indexes, foreign keys, reset sequences | |
-- CAST varchar to varchar instead of text |
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
<% if facade.logged_in? %> | |
<ul> | |
<% facade.active_users.each do |user| %> | |
<li><%= user.name %></li> | |
<% end %> | |
</ul> | |
<% else %> | |
<p>You are not logged in!</p> | |
<% 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
url\(['|"].?.?/images/([a-zA-Z0-9\-.\/]*)['|"]\) | |
image-url('$1') |
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
# http://pivotallabs.com/sanitizing-solr-requests/ | |
module SolrStringSanitizer | |
ILLEGAL_SOLR_CHARACTERS_REGEXP = /[\+\-\!\(\)\{\}\[\]\^\|"~\*\?:;&]/ | |
def self.sanitize(string) | |
if string | |
string.gsub(ILLEGAL_SOLR_CHARACTERS_REGEXP,"") | |
end | |
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
gem 'twitter' | |
gem 'twitter-text' |
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/bash | |
# /usr/local/bin/createSite.sh -d domain -t com -u user -p password -r [email protected]:user/repo.git | |
# TODO: SCP could be done in reverse | |
domain='' | |
tld='' | |
username='' | |
password='' |
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
<% [:error, :alert, :notice].each do |key| %> | |
<%= "<div class='message #{key}'>#{flash[key]}</div>".html_safe if flash[key].present? %> | |
<% 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
# Multi-environment deployment recipe | |
require 'bundler/capistrano' | |
task :production do | |
set :application, "Appname" | |
set :repository, "[email protected]:user/repo.git" | |
set :branch, "master" | |
set :deploy_to, "/var/www/vhosts/domain.co.uk" | |
server "server.domain.com", :app, :web, :db, :primary => true |
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
// Pass an array of image locations, and an optional callback function | |
function preload_images(images, callback){ | |
var preloaded = 0; | |
jQuery.each(images, function(index, image){ | |
var image = $('<img />').attr('src', image).load(function(){ | |
preloaded++; | |
if(preloaded == images.length){ callback(); } | |
}); | |
}); | |
} |
NewerOlder