Skip to content

Instantly share code, notes, and snippets.

View linuxsable's full-sized avatar

Tyler Van Hoomissen linuxsable

View GitHub Profile
const int ledsLength = 3;
int leds[ledsLength] = {0, 1, 2};
int delaySpeed = 25;
int x = 0;
void turnOnLed(int led);
void turnOffLed(int led);
void turnOnLeds(int leds[]);
void turnOffLeds(int leds[]);
void flashLeds(int leds[], int speed);
// Check Twitter username & password
- (void)initiateCredentialCheckWithUsername:(NSString *)username password:(NSString *)password {
self.authCID = [self.twitterEngine getXAuthAccessTokenForUsername:username password:password];
self.twitterUsername = username;
}
- (void)requestFailed:(NSString *)requestIdentifier withError:(NSError *)error {
NSLog(@"Request failed");
NSLog(@"%@", requestIdentifier);
NSLog(@"%@", error);
require 'rubygems'
require 'net/http'
# This fails
Thread.new {
uri = URI.parse('http://postbin.heroku.com/3v')
Net::HTTP.post_form(uri, {'data'=> 'fail'})
}
# This works
post '/messages_async' do
Thread.new(params[:data]) do |params_data|
data = JSON.parse(params_data)
channel_name = data['channel'] || 'boo'
message = data['message'] || nil
if record = Channel.first(:name => channel_name)
if message and record.id
subscribers = Subscriber.all(:channel_id => record.id)
if subscribers
class DB
@@database_path = File.dirname(__FILE__) + '/../db/db.yaml'
attr_accessor :data
def initalize
load
end
def write(data)
(function($) {
$.fn.opacityCheck = function(key) {
if (key == ':visible') {
if (this.css('opacity') == 1) {
return true;
}
return false;
}
else if (key == ':invisible') {
if (this.css('opacity') == 0) {
@linuxsable
linuxsable / gist:670140
Created November 10, 2010 00:41
JS console snippet for TextMate
console.log(${1:'firing'});
// Check to make sure this is going to be the only
// occupant of the new coordinates.
var that = this;
var createCoords = function() {
var o = [];
// coords[0] = helpers.generateRandomNumber(this.BOARD_WIDTH - 1);
// coords[1] = helpers.generateRandomNumber(this.BOARD_HEIGHT - 1);
o[0] = helpers.generateRandomNumber(2);
if (typeof l == undefined) {
var l = function(v) {
if (typeof console != undefined && typeof console.log != undefined) {
console.log(v);
}
}
}
#!/bin/sh
echo "Firing up the servers baby!"
sleep 1
cd /var/steam/orangebox
screen -m -d -t hl2mp1 -S steam ./srcds_run -console -game hl2mp +map dm_underpass -autoupdate -port 30100
screen -m -d -t hl2mp2 -S steam ./srcds_run -console -game hl2mp +map dm_underpass -autoupdate -port 30200