Skip to content

Instantly share code, notes, and snippets.

View peterc's full-sized avatar
🏠
Working from home

Peter Cooper peterc

🏠
Working from home
View GitHub Profile
@peterc
peterc / 0what.md
Created August 25, 2009 01:58 — forked from defunkt/0what.md

Poor Man's Deploy

  • Start a Sinatra server on port 4000
  • GET / to that server triggers a git pull and mod_rails restart
  • Hit port 4000 locally after pushing

Why?

$ gem push pkg/choice-0.1.4.gem
Pushing gem to Gemcutter...
You do not have permission to push to this gem.
$ gem migrate choice
Starting migration of choice from RubyForge...
A migration token has been created.
Uploading the migration token to choice.rubyforge.org. Please enter your RubyForge login:
Login: defunkt
Password:
# === Documentation === #
# This is just a standard shell script, which is loaded from the
# post-receive hook when a new branch is created.
# Just don't forget that gems you have on your local machine probably
# aren't installed at the server, at least before you run gem bundle.
# Your working directory is root of your application which was just cloned
# here. (Probably) unlike to your local machine, basename is name of the branch,
# not name of the application. It shouldn't matter in most cases, but sometimes
/*
* TypeHelpers version 1.0
* Zoltan Hawryluk, Nov 24 2009.
* @see http://www.useragentman.com/blog/2009/11/29/how-to-detect-font-smoothing-using-javascript/
*
* Released under the MIT License. http://www.opensource.org/licenses/mit-license.php
*
* Works for
* - IE6+ (Windows),
* - Firefox 3.5+ (Windows, Mac, Linux),
@peterc
peterc / redis-server
Created April 25, 2010 01:57 — forked from tessro/redis-server
Redis etc/init.d file
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
http: require 'http'
sys: require 'sys'
client: http.createClient(3000, "localhost")
server: http.createServer (req, res) ->
clientReq: client.request(req.method, req.url, req.headers)
clientReq.addListener 'response', (clientRes) =>
res.writeHead(clientRes.statusCode, clientRes.headers)
clientRes.addListener 'data', (chunk) =>
res.write chunk
@peterc
peterc / tumblr-backup.rb
Created June 3, 2010 03:33 — forked from jmahoney/tumblr-backup.rb
Tumblr backup in Ruby
#!/usr/bin/env ruby
#
# Copyright (c) 2010 Joe Mahoney
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
require "application_responder"
class ApplicationController < ActionController::Base
# ...
def self.acts_as_magical
around_filter :magic_new, :only => :new
around_filter :magic_show, :only => :show
around_filter :magic_edit, :only => :edit