Skip to content

Instantly share code, notes, and snippets.

View DavidAntaramian's full-sized avatar

David Antaramian DavidAntaramian

View GitHub Profile
<?php
$event = 0;
try {
// attempts to get an event object from the Event library
// using the original command as defined in the WaiCommand
$event = Event::get_event($command->get_original(), $_SESSION['instance_id']);
// actually handles the event and returns the text to be rendered
return $event->handle();
@DavidAntaramian
DavidAntaramian / rfcomm
Created January 31, 2011 09:12
rfcomm boot script
#! /bin/sh
#
### BEGIN INIT INFO
# Provides: rfcomm
# Required-Start: $syslog $local_fs dbus udev bluetooth
# Required-Stop: $syslog $local_fs dbus udev bluetooth
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bluetooth communication ports
# Description: Runs `rfcomm bind all` to create /dev/rfcomm*
@DavidAntaramian
DavidAntaramian / synergy.conf
Created May 29, 2011 23:03
Daemon configuration file for Synergy (http://synergy-foss.org/)
section: screens
behemoth:
Chansey.local:
alt = super
super = alt
Crystal.local:
alt = super
super = alt
Agatha.local:
alt = super
@DavidAntaramian
DavidAntaramian / minion.js
Created March 21, 2012 20:39
This is the current code for a JavaScript module that I'm working on. It is supposed to create a singleton named Parousia.
Parousia.minion = {};
(function(instance) {
var module = instance || {};
module.unit = function() {
/*
* Graphical stats:
*/
this.id = 0;
this.pixelx = 0;
@DavidAntaramian
DavidAntaramian / clubs_people.rb
Created August 10, 2012 22:44
Migration to create a has_and_belongs_to_many join table between the Club model and the People model
class ClubsPeople < ActiveRecord::Migration
def change
create_table :clubs_people, :id => false do |t|
t.references :person, :club
end
add_index :clubs_people, [:club_id, :person_id], :unique => true, :name => "by_club_person"
end
end
@DavidAntaramian
DavidAntaramian / blogs.example.net.vhost.conf
Last active October 11, 2015 12:07
WordPress Networks and Domain Mapping on Apache 2.x
<VirtualHost *:80>
ServerAdmin admin@example.net
ServerName blogs.example.net
# Blogs with their own domain
ServerAlias fred.example.net
ServerAlias maria.example.net
# External domains can be added, so long as they resolve to this server
ServerAlias excellentcustomerservice.example
ServerAlias www.fredscoolblog.example
#!/usr/bin/env ruby
# Redmine-Gitolite Hook for Redmine Git Hosting v 0.7.7
# Copyright (c) 2014 by David Antaramian (david@antaramian.com)
# Released under the MIT License (SPDX:MIT;https://spdx.org/licenses/MIT)
#
# Modeled after the original hook by Nicolas Rodriguez, et al.
# Original hook available at:
# https://github.com/jbox-web/redmine_git_hosting/blob/0.7.7/contrib/hooks/post-receive.redmine_gitolite.rb
#
@DavidAntaramian
DavidAntaramian / sidekiq_garbage_collector.rb
Last active December 2, 2015 21:26
Forcing JRuby garbage collection for Sidekiq
require 'java'
module App
module Middleware
# Middleware for forcing run of the garbage collector after a task
# finishes. A "server," in this case, is any code that is overseeing
# the processing of an asynchronous queue.
class SidekiqGarbageCollector
# Garbage collection will only be forced if the amount of
# memory used exceeds this constant (represented as bytes in
config :slackreceipt, :oauth
consumer_key: "consumer-key",
private_key_path: "/Users/joshdholtz/Projects/slackreceipt/priv/key.key"
@DavidAntaramian
DavidAntaramian / README.md
Created July 27, 2016 17:41
Homebrew Launchd Script

Updates Homebrew every morning at 3AM computer time.

Installation

Drop sh.brew.update.plist into ~/Library/LaunchAgents/. The launchd daemon will take care of the rest the next time you log in to your machine.

Caveats

If you use a specific version of Ruby, you will need to ensure that the executable is in the