Skip to content

Instantly share code, notes, and snippets.

View levicole's full-sized avatar

Levi Cole levicole

  • Kolide
  • Nashville, TN
View GitHub Profile
#include <stdio.h>
//usage cat javascript.js | minifier > javascript.mini.js
int main(int argc, char const* argv[])
{
int c;
while ((c=getchar()) != EOF) {
if (c!= '\n' && c!='\t' && c!='\r')
putchar(c);
}
return 0;
@levicole
levicole / hack
Created September 14, 2009 03:22 — forked from ymendel/hack
#!/bin/sh
BRANCHES=`git branch`
if [ $? != 0 ]; then
exit
fi
GIT_SVN=0
git branch -r | grep 'git-svn' > /dev/null
if [ $? = 0 ]; then
GIT_SVN=1
def get_input
print ">>"
STDOUT.flush
response = STDIN.gets.chomp
case response
when "exit"
puts "bye!"
@running = false
when "time"
puts "The Time is:#{Time.now}"
Proc.new { |env|
status, headers, body =
begin
@app.call(env)
rescue => boom
raise
end
[status, headers, body]
}
" freakin sweet iterpolation
let g:surround_{char2nr("#")} = "#{\r}"
aasm_column :state
aasm_initial_state :division_selection
aasm_state :division_selection
aasm_state :track_selection
aasm_state :track_selected
aasm_event :select_division do
transitions :to => :track_selection, :from => [ :division_selection ]
end
render :xml => Twilio::Verb.new { |v|
v.gather(:numDigits => 1, :timeout => 5, :action => recording_script_notification_url(@notification)) do
v.play @notification.voicemessage_url
v.say "If you would like to record again, press one, otherwise stay on the line"
end
v.say "Your notification is being sent"
v.redirect send_notification_notification_url(@notification)
}.response
require 'rubygems'
require 'gosu'
include Gosu
class MouseInfo < Window
CENTER = 640/2
BOTTOM = 480
def initialize
super(640, 480, false)
@clicked = ""
require 'rubygems'
require 'gosu'
include Gosu
class MouseInfo < Window
CENTER = 640/2
BOTTOM = 480
def initialize
super(640, 480, false)
@clicked = ""
// usage: $("#element").copyFields("#to", "#from")
(function($) {
$.fn.copyFields = function(to, from) {
// find all the inputs in to
var to = $(to + " input");
// find all the inputs in from
var from = $(from + " input");
// when you click on the element
$(this).click(function() {
//loop through all the from inputs and put the value in the to input...