Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View michaelmior's full-sized avatar
💭
👨‍💻

Michael Mior michaelmior

💭
👨‍💻
View GitHub Profile
@michaelmior
michaelmior / MyHTTPClient.m
Created September 26, 2012 20:36
Override of requestWithMethod:path:parameters:
- (NSMutableURLRequest *)requestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters
{
NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
OAConsumer *consumer = [[OAConsumer alloc] initWithKey:OAUTH_CONSUMER_KEY secret:OAUTH_CONSUMER_SECRET];
OAHMAC_SHA1SignatureProvider *provider = [[OAHMAC_SHA1SignatureProvider alloc] init];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url consumer:consumer token:self.token realm:@"Bunch API" signatureProvider:provider];
[request setHTTPMethod:method];
[request setAllHTTPHeaderFields:self.defaultHeaders];
if ([method isEqualToString:@"GET"] || [method isEqualToString:@"HEAD"]) {
@michaelmior
michaelmior / talker-webkit.js
Created March 21, 2012 22:56
TalkerApp notifications for webkit
javascript:(function(){window.notifications={notifications_support:function(){return%20true;},notify:function(obj){if(obj.title%20!=window.notifications.prevmsg.title%20%26%26%20obj.description%20!=window.notifications.prevmsg.description){var%20not=window.webkitNotifications.createNotification('http://talkerapp.com/images/favicon.png',obj.title,obj.description);not.show();window.setTimeout(function(){not.cancel();},5000);}window.notifications.prevmsg=obj;},prevmsg:{}};})();
@michaelmior
michaelmior / rename-db.sh
Created August 26, 2011 16:20
Simple script to move all tables from one database to another. Please don't use this in production as it could fail horribly. Also, RENAME table doesn't work on views, so they won't be migrated.
#!/bin/sh
OLD_DB=$1
NEW_DB=$2
TABLES=`echo "SHOW TABLES IN $1;" | mysql -NB`
IFS="
"