This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float InvSqrt (float x) | |
{ | |
float xhalf = 0.5f*x; | |
int i = *(int*)&x; | |
i = 0x5f3759df - (i>>1); | |
x = *(float*)&i; | |
return x*(1.5f - xhalf*x*x); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// detect time zone | |
Event.observe(window, 'load', function() { | |
var date = new Date(); | |
date.setTime(date.getTime() + (1000*24*60*60*1000)); | |
var expires = "; expires=" + date.toGMTString(); | |
var offset = -(new Date().getTimezoneOffset() / 60); | |
document.cookie = "timezone=" + offset + expires + "; path=/"; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# upstart script for nginx | |
description "nginx" | |
start on (net-device-up and local-filesystems) | |
stop on runlevel [016] | |
expect fork | |
respawn | |
exec /opt/nginx/sbin/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIImage(Utilities) | |
-(UIImage *)scaledToSize:(CGSize)size { | |
// if we're already that size, just return us | |
if(fabs([self size].width - size.width) < 0.001 && fabs([self size].height - size.height) < 0.001) { | |
return [[self retain] autorelease]; // we need to do this so that we could release the "original" before retaining the resized "copy" | |
} | |
int pixelsWide = size.width + 0.5; | |
int pixelsHigh = size.height + 0.5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert bufferpopoverbackground.png -fill none -draw "matte 0,0 reset" -tile bufferpopoverbackground.png -draw "rectangle -1,-1 306,180" \( +clone -background black -shadow 255x5+0+0 \) +swap -background none -layers merge +repage output.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final Class[] mStartForegroundSignature = new Class[] { | |
int.class, Notification.class}; | |
private static final Class[] mStopForegroundSignature = new Class[] { | |
boolean.class}; | |
private NotificationManager mNM; | |
private Method mStartForeground; | |
private Method mStopForeground; | |
private Object[] mStartForegroundArgs = new Object[2]; | |
private Object[] mStopForegroundArgs = new Object[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rack' | |
require 'addons' | |
require 'exceptional' | |
require 'json' | |
configure :production do | |
set :raise_errors, false | |
Exceptional.configure ENV['EXCEPTIONAL_API_KEY'] | |
Exceptional::Remote.startup_announce(::Exceptional::ApplicationEnvironment.to_hash('sinatra')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
basic: ['android_low', 'android', 'android_high'], | |
premium: ['android_premium_low', 'android_premium_medium', 'android_premium', 'android_premium_high'], | |
defaults: { | |
basic_wwan: 'android', | |
basic_wifi: 'android_high', | |
premium_wwan: 'android_premium_medium', | |
premium_wifi: 'android_premium' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'mechanize' | |
URL_PRELOADER = 'https://customer.comcast.com/Secure/Preload.aspx?backTo=%2fSecure%2fUsers.aspx&preload=true' | |
URL_USERS = 'https://customer.comcast.com/Secure/Users.aspx' | |
URL_ACCOUNT = 'https://customer.comcast.com/Secure/Account.aspx' | |
abort "Usage: #{$0} <username> <password>" unless ARGV.length == 2 |
OlderNewer