Skip to content

Instantly share code, notes, and snippets.

View shayne's full-sized avatar

Shayne Sweeney shayne

  • EST (UTC-5)
View GitHub Profile
require 'rubygems'
require 'tweetstream'
require 'open-uri'
require 'json'
tweetstream = TweetStream::Client.new("user", "pass")
tweetstream.track('♫') do |tweet|
q = tweet.text.gsub(/[^a-z\s]/i, '')
// What I'm going after: http://img515.yfrog.com/img515/3872/90335114.png
[TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithTopLeft:-1 topRight:-1 bottomRight:-1 bottomLeft:-1]
next:[TTSolidFillStyle styleWithColor:[UIColor lightGrayColor]
next:[TTBoxStyle styleWithMargin:UIEdgeInsetsZero padding:UIEdgeInsetsMake(0, 8, 0, 8)
next:[TTTextStyle styleWithFont:[UIFont boldSystemFontOfSize:15]
color:[UIColor whiteColor]
minimumFontSize:15
shadowColor:nil
shadowOffset:CGSizeZero
textAlignment:UITextAlignmentCenter
-- get properties of the playing track
tell application "PandoraBoy"
set trackArtist to artist of current track
set trackName to name of current track
end tell
-- change the status message to your liking here:
set tweet to "♫ " & trackArtist & " - " & trackName
-- let the user edit
require 'nokogiri'
require 'open-uri'
station_id = 'ea1cf660a072089e6d1a8c963c4de754ce73ab3d53acab5f'
songs = []
['track', 'thumb_up'].each do |s|
doc = Nokogiri::HTML(open("http://www.pandora.com/favorites/station_tablerows_#{s}.vm?token=#{station_id}"))
require 'nokogiri'
require 'open-uri'
require 'pp'
products = []
macs = %w{imac macbook macbook_pro macbook_air mac_mini mac_pro xserve displays mac_accessories}
macs.each do |mac|
doc = Nokogiri::HTML(open("http://store.apple.com/us/browse/home/specialdeals/mac/#{mac}"))
#import <UIKit/UIKit.h>
@interface RoundedCornerTestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window_;
}
@end
@shayne
shayne / gvoice.rb
Created December 15, 2009 06:21
A quick interface to the Google Voice using an undocumented API
require 'rest_client'
class GVoice < Struct.new :e, :p
def initialize(*args, &block)
super; instance_eval &block if block_given?
end
def send_sms(number, text)
post 'sms/send', :phoneNumber => number, :text => text, :_rnr_se => get[/'_rnr_se': '([^']+)'/, 1]
end
#ifdef DEBUG
#define DLog(...) NSLog(@"%s:%d %s - %@", __FILE__, __LINE__, __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#define DLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
#endif
#define ALog(...) NSLog(@"%s:%d %s - %@", __FILE_, __LINE__, __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#endif
@shayne
shayne / ec2-host.py
Created January 6, 2011 02:23
Easily get ec2 public hosts, open a shell or run commands...
#!/usr/bin/env python
import os
import sys
import getopt
import boto
from sys import stderr
_ec2 = None
@shayne
shayne / gist:885579
Created March 24, 2011 18:30
[iOS] Simulate memory warning on device
[[UIApplication sharedApplication] _performMemoryWarning];