Skip to content

Instantly share code, notes, and snippets.

View sycobuny's full-sized avatar

Stephen Belcher sycobuny

  • Kelly Services, NIH/NIA
  • Baltimore, MD
View GitHub Profile
@sycobuny
sycobuny / 001_start.pl
Created November 16, 2012 20:31
Example Migration in Perl
PLModel::Migration {
$migration->table users => sub {
$table->primary_key;
$table->text name => {null => FALSE};
$table->text login => {null => FALSE, unique => TRUE};
$table->text salt => {null => FALSE};
$table->text password => {null => FALSE};
};
@sycobuny
sycobuny / topics.md
Created November 19, 2012 16:13
Possible Topics for 2012-10-19 Programmer's Meeting

Intro to Sass

http://github.com/sycobuny/sass_presentation

This is an intro to the "Sass" (not "SAS") language, which is a templating language used to generate CSS from a more minimal set of instructions, as well as a set of functions which can help with design and layout (mathematical operators in CSS!)


Code Smells (and what to do about them)

@sycobuny
sycobuny / js_question.md
Created November 20, 2012 20:17
Question about prototype declarations in JS and "standard practice"

There's a couple ways to define an "object" in JavaScript.

The following uses a standard function to declare a class and some attributes and an accessor:

function Car(make, model, year) {
    this.make  = make;
    this.model = model;
    this.year  = year;
@sycobuny
sycobuny / Gemfile
Created November 29, 2012 19:12
A bare-bones "just getting started" sinatra+sequel script
source :rubygems
gem 'sinatra'
gem 'sequel'
gem 'pg'
@sycobuny
sycobuny / dynamic_routes.rb
Created December 13, 2012 17:12
Displaying loading a dynamic route via ENV, but with a default
require 'sinatra'
asdf = ENV['asdf'] || '/asdf'
get asdf do
'asdf'
end
@sycobuny
sycobuny / tmux-attach.bash
Created December 27, 2012 18:26
Script for re-attaching to existing tmux sessions while maintaining window independence, à la `screen -x`
#!/bin/bash
#
# Re-modified script from
# https://mutelight.org/practical-tmux
# Which is modified from:
# http://forums.gentoo.org/viewtopic-t-836006-start-0.html
#
# chmod +x it and put it in your $PATH for easy use; I stuck it in
# ~/.tmux-attach.bash and added an alias for it, do whatever you like.
@sycobuny
sycobuny / redirect.php
Last active December 11, 2015 08:29
Obsessive amounts of redirection
<?php
function redirect($url, $exit_status = 1) {
header('HTTP/1.0 303 See Other', true, 303);
header("Location: $url");
echo "<html><head><meta http-equiv='refresh' content='0;$url'></head>";
echo "<body><script>window.location='$url'</script></body></html>";
exit($exit_status);
}
var responses = {
leader: function() {
bot.say(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '')
console.log(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '')
},
luckydog: function() {
bot.say(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '')
console.log(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '')
},
\version "2.16.2"
\header {
title = "Ombra Mai Fu"
composer = "Georg Friederich Handel"
}
upper = \relative c' {
\clef treble
\key f \major
\time 3/4
@sycobuny
sycobuny / namespaces.rb
Created March 13, 2013 21:19
Demonstrating some namespacing layouts in ruby
module Sequel
class Model
end
end
module Models
class User < Sequel::Model; end
class Post < Sequel::Model; end
end