Skip to content

Instantly share code, notes, and snippets.

View erikh's full-sized avatar

Erik Hollensbe erikh

View GitHub Profile
################################################################################
#
# notify.pl - use libnotify to work like growl
#
# By Erik Hollensbe <erik@hollensbe.org>
#
# usage:
#
# See the CALLBACK_MAP below? Those are the defined message types.
#
function process_template(url, id, data) {
$.ajax({
url: url,
data: data,
success: function(msg, ts) { $(id).empty(); $(id).append(msg); }
});
}
function process_json(push_object) {
if (push_object && push_object.url && push_object.data && push_object.id)
<html>
<head>
<title>Welcome to nginx!</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="templater.js"></script>
</head>
<body bgcolor="white" text="black">
<div id="one">Location #1</div>
<div id="two">Location #2</div>
</body>
<dl>
<dt>"Foo":</dt>
<dd><!-- #foo# --></dd>
<dt>"Bar":</dt>
<dd><!-- #bar# --></dd>
</dl>
<dl>
<dt>"Foo":</dt>
<dd><!-- #foo# --></dd>
<dt>"Bar":</dt>
<dd><!-- #bar# --></dd>
</dl>
function process_template(url, id, data) {
$.ajax({
url: url,
data: data,
success: function(msg, ts) { $(id).empty(); $(id).append(msg); }
});
}
function process_json(push_object) {
if (push_object && push_object.url && push_object.data && push_object.id)
require 'rubygems'
require "dbi"
require 'pg'
dbh = DBI.connect("dbi:Pg:gosu_dev", "erikh")
dbh.do("drop table stuff") rescue nil
dbh.do("create table stuff (id serial primary key, my_string varchar(20), my_integer integer, my_time timestamp)")
chars = ('a'..'z').to_a + ('0'..'9').to_a
require 'rubygems'
require "dbi"
require 'pg'
dbh = DBI.connect("dbi:Pg:gosu_dev", "erikh")
dbh.do("drop table stuff") rescue nil
dbh.do("create table stuff (id serial primary key, my_string varchar(20), my_integer integer, my_time timestamp)")
chars = ('a'..'z').to_a + ('0'..'9').to_a
#!/usr/bin/ruby
require 'pp'
log = File.open('access.log', 'r')
begin
lines = []
5.times do
line = log.readline
## The tests in /some/path/test/suite/example.rb [ruby]
BareTest.suite "Map Example Suite" do
suite "Regular Nested Suite" do
assertion "A successful assertion" do
true
end
assertion "A failing assertion" do
failure "Just as an example"
end