This file contains hidden or 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 macruby | |
# From: http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/ | |
# Expanded from here: http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/ | |
# Xcode auto-versioning script for Subversion by Axel Andersson | |
# Updated for git by Marcus S. Zarra and Matt Long | |
# Converted to ruby by Abizern | |
# Converted to MacRuby by Gregory Furmanek | |
# Merged with MacRuby version by elliottcable | |
# Appends the git sha to the version number set in Xcode. |
This file contains hidden or 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
#!/bin/sh | |
mkdir -p /usr/local/src && cd /usr/local/src | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.bz2 | |
tar -xjvf ruby-1.9.1-p0.tar.bz2 | |
cd ruby-1.9.1-p0 | |
./configure --prefix=/usr --program-suffix=19 --enable-shared | |
make && make install |
This file contains hidden or 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 | |
# | |
# usage: script/server_restarter | |
# | |
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+ | |
# is so fast when completely reloading the server, I wrote this script to listen to the | |
# given directories, and kill/restart the server when any file is changed. | |
# | |
# It's quick, simple, and it reliably reloads your application when changes are made. | |
# |
This file contains hidden or 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
RELEASE_OUTPUT_PATH = File.expand_path("~/Projects/releases/Squeemote") | |
TARGET_NAME = "Squeemote" | |
CONFIGURATION = ENV['CONFIGURATION'] || "Distribution" | |
SDK_VERSION = ENV['SDK'] || 'iphoneos2.2' | |
task :release do | |
puts "* Bumping build version." | |
`agvtool bump -all` | |
puts "* Building #{CONFIGURATION} release." |
This file contains hidden or 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
# http://www.geocities.com/calshing/dayofweek.htm | |
def get_week( year , month , day) | |
c = year.to_s[0, year.to_s.length-2 ].to_i | |
y = year.to_s[year.to_s.length-2,2] | |
a = (14-month)/12 | |
y = y.to_i - a | |
m = month + 12*a - 2 | |
y_div_4 = ( y == 0 )? 0 : (y/4) | |
This file contains hidden or 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
YES CHRIS, I WROTE THIS UP -- ERICA (erica.sadun@arstechnica.com) | |
p.s. Follow me on twitter: @ericasadun | |
------------- | |
Note: UK People start here: http://twitter.com/timmeh/status/1351833678 | |
Note: US People look here: http://tinyurl.com/cstrqx (New version by Michael Johnston of iPhone Alley) | |
HOW TO ENABLE TETHERING ON YOUR 3.0 iPHONE |
This file contains hidden or 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
BOOL IsWIFIConnection | |
{ | |
BOOL ret = YES; | |
struct ifaddrs * first_ifaddr, * current_ifaddr; | |
NSMutableArray* activeInterfaceNames = [[NSMutableArray alloc] init]; | |
getifaddrs( &first_ifaddr ); | |
current_ifaddr = first_ifaddr; | |
while( current_ifaddr!=NULL ) | |
{ | |
if( current_ifaddr->ifa_addr->sa_family==0x02 ) |
This file contains hidden or 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
class Progress | |
require 'action_view/helpers/date_helper' | |
include ActionView::Helpers::DateHelper | |
def initialize(total, interval = 10) | |
@total = total | |
@interval = interval | |
@count = 0 | |
@start = Time.now | |
end |
This file contains hidden or 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 'sinatra' | |
require 'redis' | |
# To use, simply start your Redis server and boot this | |
# example app with: | |
# ruby example_note_keeping_app.rb | |
# | |
# Point your browser to http://localhost:4567 and enjoy! | |
# |
This file contains hidden or 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
module HTML | |
class StathamSanitizer < WhiteListSanitizer | |
protected | |
def tokenize(text, options) | |
super.map do |token| | |
if token.is_a?(HTML::Tag) && options[:parent].include?(token.name) | |
token.to_s.gsub(/</, "<") | |
else |