Skip to content

Instantly share code, notes, and snippets.

View kastner's full-sized avatar
🕳️
actively choosing...

Erik Kastner kastner

🕳️
actively choosing...
View GitHub Profile
user www-data www-data;
worker_processes 4;
events {
worker_connections 1024;
use epoll;
}
http {
include mime.types;
#!/usr/bin/env ruby
%w|back1 front1 static tagback|.each do |host|
`source ~/.keychain/harland-sh && ssh #{host} ./update`
end
#!/usr/bin/env ruby
hosts = []
hosts << open("#{ENV["HOME"]}/.ssh/config").read.scan(/host\s(.+?)\n/i).uniq
hosts << open("#{ENV["HOME"]}/.ssh/known_hosts").read.scan(/^(.*) ssh/).map do |h|
host = h[0].gsub(/,.*/,'')
host = "'#{$1} -p #{$2}'" if host.match(/\[(.*)\]:(.*)/)
host
end
named_scope :newest_first, :order => "start_at desc"
named_scope :ending_first, :order => "end_at"
named_scope :past_day, :conditions => ["start_at >= ? AND start_at <= ?", Time.now - 1.day, Time.now]
named_scope :does_expire, :conditions => { :does_not_expire => false}
named_scope :never_expire, :conditions => { :does_not_expire => true}
named_scope :active1, :conditions => { :status => true }
named_scope :started, :conditions => ["start_at <= ? OR start_at IS NULL", Time.now]
named_scope :not_ended, :conditions => ["end_at >= ? OR end_at IS NULL", Time.now]
named_scope :ending, :conditions => ["end_at >= ? AND end_at <= ?", Time.now, Time.now + 7.days]
## Code from Joe Stump
# Create your views here.
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.core import serializers
def index(request, group, function, path, output):
try:
api = API(request, path)
require 'camping'
Camping.goes :Blog
module Blog::Controllers
class Index < R '/'
def get
render :index
end
end
air-kastner:gist-25951 kastner$ rackup -I config.ru -p 3000
./rack/lib/rack.rb:17: warning: already initialized constant VERSION
Mon Nov 17 18:42:30 -0500 2008: Read error: #<LocalJumpError: no block given>
/Library/Ruby/Gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:284:in `each'
/Library/Ruby/Gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:284:in `send'
/Library/Ruby/Gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:284:in `method_missing'
/Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/lint.rb:371:in `each'
/Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/commonlogger.rb:36:in `each'
/Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb:68:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
#!/bin/env ruby
##
# Originally from http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/StakingOutFileChanges.rdoc
# Modified by Geoffrey Grosenbach http://peepcode.com
#
# Watches files and runs a command when any of them are modified.
#
# If one argment is given, will run that command and watch app, lib, test, spec.
#
def _new_home
textalize <<-HTML
h1. Welcome to Peg list from Meta | ateM
A peg list is a memory device that has been used for thousands of years.
For more information on peg lists and why they are useful for anyone, <a href="/what">read "What is a peg list"</a>.
Peg list from Meta | ateM will let you record your peg list, and associate each peg with an image to help strengthen the association -- peg lists work best when your form pictures in your mind.
from django.utils import simplejson as json
from google.appengine.api import urlfetch
class MyFlickr(object):
"""A simple class for dealing with flickr via the API"""
def __init__(self, api_key):
super(MyFlickr, self).__init__()
self.api_key = api_key
self.api_host = "http://api.flickr.com/services/rest/"