This file contains hidden or 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
namespace :deploy do | |
# Ask whether to reindex before restarting Passenger | |
task :restart, :roles => :app, :except => {:no_release => true} do | |
solr.reindex if 'y' == Capistrano::CLI.ui.ask("\n\n Should I reindex all models? (anything but y will cancel)") | |
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}" | |
end | |
desc 'create shared data and pid dirs for Solr' | |
task :setup_solr_shared_dirs do | |
# conf dir is not shared as different versions need different configs |
This file contains hidden or 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 | |
// Set these dependant on your BB credentials | |
$username = 'username'; | |
$password = 'password'; | |
// Grab the data from BB's POST service and decode | |
$json = stripslashes($_POST['payload']); | |
$data = json_decode($json); |
This file contains hidden or 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
module ActionController | |
class Metal | |
attr_internal :cached_content_for | |
end | |
module Caching | |
module Actions | |
def _save_fragment(name, options) | |
return unless caching_allowed? |
This file contains hidden or 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
# Assuming you've setup Dragonfly to use your local filesystem, here's what you would | |
# do to get the images over to Amazon S3 | |
# Specify the base path to where images reside on your system | |
DRAGONFLY_PATH = Rails.root.join("public", "system", "dragonfly", Rails.env) | |
# Next you'll need to loop over each model that is using dragonfly | |
SlideRiff.all.each do |riff| | |
slide_image_file = DRAGONFLY_PATH.join(riff.slide_image_uid) | |
# check if the file exists on the local filesystem, this allows you to |
This file contains hidden or 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
<!DOCTYPE html> | |
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Breakpoint detection test</title> | |
<style type="text/css" media="screen"> | |
@media screen and (min-width: 320px) { | |
#page:after { | |
content: 'smallest'; /* represent the current width-bracket */ |
This file contains hidden or 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
<!DOCTYPE html> | |
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Breakpoint detection test</title> | |
<style type="text/css" media="screen"> | |
@media screen and (min-width: 320px) { | |
#page:after { | |
content: 'smallest'; /* represent the current width-bracket */ |
This file contains hidden or 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
array( | |
'url' => '...', | |
'title' => '...', | |
'author' => '...', | |
'id' => 123 // the new item | |
) |
This file contains hidden or 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 urlFromHash() { | |
if (location.hash.substr(0, 2) != '#!') { | |
return null; | |
} | |
// why not location.hash? => http://stackoverflow.com/q/4835784/298479 | |
return location.href.split('#')[1].substr(1); | |
} | |
$('#gallery').magnificPopup({ | |
type: 'image', |
This file contains hidden or 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 'open-uri' | |
require 'ipaddr' | |
def generate_lookup_table | |
delegation_lists = [ | |
'ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest', | |
'ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest', | |
'ftp://ftp.arin.net/pub/stats/arin/delegated-arin-latest', | |
'ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest', | |
'ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-latest' |
This file contains hidden or 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
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb | |
class AddAuthenticationTokenToUsers < ActiveRecord::Migration | |
def change | |
add_column :users, :authentication_token, :string | |
add_index :users, :authentication_token, :unique => true | |
end | |
end |