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
@kastner
kastner / gist:545
Created July 22, 2008 01:00 — forked from anonymous/gist:543
Joe's meta-programing for testing private stuff in PHP
<?php
class Foo
{
protected $user = null;
public function __construct($user)
{
$this->user = $user;
}
require 'net/http'
require 'uri'
class ScreenShooter
SCREEN_SHOOTER_URL = 'http://www.browsrcamp.com/'
class << self
def screenshot_for(url)
returning new(url) do |shooter|
shooter.shoot
end
@kastner
kastner / gist:16288
Created October 11, 2008 16:22 — forked from queso/gist:16284
########## Why does the yield output outside the content_tag block?
# Method
def submit(*args)
block_output = yield
@template.content_tag(:div, :class => "save_actions") {
super(*args) + block_output
}
end
options.scan(/\w+=\w+/).inject({}) { |h,opt| kv = opt.split('='); h[kv.first] = kv.last; h }
class ActiveRecord::Base
@@cache_store = nil
def self.cache_store
@@cache_store ||= ActionController::Base.cache_store
end
def self.caches(method_name, key = nil, options = {}, &block)
if key.is_a?(Hash)
options = key
key = nil
#!/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.
#
Host project1.github.com
HostName github.com
User git # Probably not needed but just a note if you want to skip it
IdentityFile ~/.ssh/your_key_file
IdentitiesOnly yes # This is only if you want to avoid trying other identities which can speed things up a bit.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="file:///Users/acaldelas/Desktop/Wine Library Concept/Code/wine-lib-script.js"></script>
<link rel="stylesheet"type="text/css"href="wine-lib-styles.css"/>
<title>Wine Library</title>
</head>
# If cached file exists, serve it and stop processing
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /cache/%{HTTP_HOST}$1 [L]
# other redirection (imgs, js, css, ...)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !.*/mephisto/.*
RewriteCond %{REQUEST_URI} !.*html
RewriteCond %{REQUEST_URI} !^/cache
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/$1 -f
//
// StompService.h
// Objective-C Stomp Client
//
// Implements the Stomp Protocol v1.0, as described here: http://stomp.codehaus.org/Protocol
// Requires the AsyncSocket library: http://code.google.com/p/cocoaasyncsocket/
//
// This class is in the public domain.
// by Scott Raymond <[email protected]>.
//