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 that allows a textarea to use the enter | |
// key to submit the associated form | |
$.fn.submitTextArea = function() { | |
return this.each(function() { | |
$(this).keypress(function(e){ | |
if (e.keyCode == 13 && !e.shiftKey) { | |
e.preventDefault(); | |
$(this).closest('form').submit(); | |
} | |
}); |
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 | |
# File: /etc/init.d/unicorn | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |
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
upstream unicorn { | |
server unix:/tmp/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name staging.meeteor.com; | |
root /vol/data/rails/meeteor_production/current/public/; | |
location / { |
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 | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
module Retryable | |
def self.included(base) | |
base.extend(self) | |
end | |
# Options: | |
# * :tries - Number of tries to perform in total, not number of retries. Defaults to 2. | |
# * :on - The Exception on which a retry will be performed. Defaults to Exception, which retries on any Exception. | |
# * :hoptoad - a hash of options that will be sent to Hoptoad along w/ the exception on errors | |
# * :final - Return when the code fails the max number of times |
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 "spec_helper" | |
describe UsersController do | |
describe "authentication" do | |
let(:user) { FactoryGirl.create(:user) } | |
it "should properly log a user out" do | |
session[:user_id] == user.id | |
AnalyticLog.should_receive(:logout) <----- (<AnalyticLog (class)>).logout(any args) expected: 1 time received: 0 times | |
get :logout |
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
def get_random_emails(emails = [], number_of_random_emails = 1) | |
random_emails = [] | |
total_emails = emails.length | |
return false if number_of_random_emails > total_emails | |
while number_of_random_emails < random_emails.length | |
random_emails << emails.shuffle.pop | |
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
@objects ||= long_running_query |
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
sudo apt-get update | |
sudo apt-get install openjdk-6-jre-headless -f | |
sudo wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz | |
sudo tar -xf elasticsearch.tar.gz | |
sudo rm elasticsearch.tar.gz | |
sudo mv elasticsearch-0.18.7 elasticsearch | |
sudo mv elasticsearch /usr/local/share | |
sudo wget http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master -O - | tar xz | |
sudo mv elasticsearch-elasticsearch-servicewrapper-3e0b23d/service /usr/local/share/elasticsearch/bin/ | |
sudo rm -rv elasticsearch-elasticsearch-servicewrapper-3e0b23d/ |
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
sudo apt-get update | |
sudo apt-get -fy install openjdk-6-jre-headless | |
sudo wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.4.deb | |
sudo dpkg -i elasticsearch-0.19.4.deb |
OlderNewer