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
def self.find(name) | |
@name = name | |
@messages = JSON.parse(settings.ironcache.cache(@name).get('messages').value) | |
Channel.new(@name, @messages) | |
end |
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
# Usage: redis-cli publish message.achannel hello | |
require 'sinatra' | |
require 'redis' | |
conns = Hash.new {|h, k| h[k] = [] } | |
Thread.abort_on_exception = true | |
get '/' do |
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
# http://jpsilvashy.com/posts/deploying-a-rails-application-on-amazon-ec2/ | |
set :application, "blog" | |
set :scm, :git | |
set :repository, "[email protected]:jpsilvashy/blog.git" | |
set :scm_passphrase, "" | |
set :user, "ubuntu" | |
set :deploy_to, "/var/www/blog" |
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
python -m SimpleHTTPServer 8888 & sleep 2 && open http://localhost:8888 |
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
#! /usr/bin/env ruby | |
require 'webrick' | |
root = File.absolute_path(".") | |
server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => root | |
# catch int and shutdown | |
trap 'INT' do server.shutdown end |
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
#!/bin/sh | |
# | |
# Install Simple Server by running this command: | |
# curl https://raw.github.com/gist/1930743/c5b9b6d6579701e2c376f84d5073d8367001bc9e/install.rb | sh | |
# | |
# Set up the environment. Respect $VERSION if it's set. | |
set -e | |
SS_ROOT="$HOME/Library/Application Support/Simple Server" |
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
#!/bin/sh | |
# W | |
# R RW W. | |
# RW::::RW DR::R | |
# :RRRRRWWWWRt:::::::RRR::::::E jR | |
# R.::::::::::::::::::::::::::Ri jiR:::R | |
# R:::::::.RERRRRWWRERR,::::::Efi:::::::R GjRRR Rj | |
# R::::::.R R:::::::::::::;G RRj WWR RjRRRRj | |
# Rt::::WR RRWR R::::::::::::::::fWR::R; WRW RW R | |
# WWWWRR:::EWR E::W WRRW:::EWRRR::::::::: RRED WR RRW RR |
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
python -m SimpleHTTPServer 8888 |
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 "bundler/capistrano" | |
load 'deploy/assets' | |
# Rake helper task. | |
# http://pastie.org/255489 | |
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
def run_remote_rake(rake_cmd) | |
rake_args = ENV['RAKE_ARGS'].to_s.split(',') | |
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}" |
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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'bson' | |
20.times do | |
puts BSON::ObjectId.new | |
end |