Skip to content

Instantly share code, notes, and snippets.

View davidwparker's full-sized avatar
🙃
Living in the Upside Down

Parker Parker davidwparker

🙃
Living in the Upside Down
View GitHub Profile
This is my gist.
There are few like it.
It is life.
It has mastered me.
Without me gist is useless.
Without gist, I am useless.
CmdUtils.CreateCommand(
{
name: "rspec",
takes: {"function": noun_arb_text},
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://davidwparker.com",
author: {name: "Jack Dempsey, fork by David Parker", email: "[email protected]"},
license: "MPL,GPL",
description: "Search rspec functions documentation",
help: "Select a rspec function",
CmdUtils.CreateCommand(
{
name: "ruby",
takes: {"function": noun_arb_text},
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://jackndempsey.blogspot.com",
author: {name: "Jack Dempsey", email: "[email protected]"},
license: "MPL,GPL",
description: "Search ruby functions documentation",
help: "Select a ruby function",
class Announcement < ActiveRecord::Base
named_scope :active, lambda { { :conditions => ['starts_at <= ? AND ends_at >= ?', Time.now.utc, Time.now.utc] } }
named_scope :since, lambda { |hide_time| { :conditions => (hide_time ? ['updated_at > ? OR starts_at > ?', hide_time.utc, hide_time.utc] : nil) } }
def self.current_announcements(hide_time)
active.since(hide_time)
end
end
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
Warden::Manager.before_failure do |env,opts|
# Sinatra is very sensitive to the request method
# since authentication could fail on any type of method, we need
# to set it for the failure app so it is routed to the correct block
env['REQUEST_METHOD'] = "POST"
end
development: &global_settings
database: textual_development
host: 127.0.0.1
port: 27017
test:
database: textual_test
<<: *global_settings
production:
#!/bin/bash
# domainavailable
# Fast, domain name checker to use from the shell
# Use globs for real fun:
# domainavailable blah{1..3}.{com,net,org,co.uk}
# Inspired by foca / giles:
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
trap 'exit 1' INT TERM EXIT
@davidwparker
davidwparker / 004.c
Created August 12, 2011 00:56
OpenGL screencast 4: drawing in 2D: triangles, quads, and polgyons
#include "screencasts.h"
/* Globals */
double dim=2; /* dimension of orthogonal box */
char *windowName = "OpenGL screenscasts 4: Drawing triangles, quads, and polygons";
int windowWidth=500;
int windowHeight=500;
/*
* Display the scene