Skip to content

Instantly share code, notes, and snippets.

View orta's full-sized avatar
🥂

Orta Therox orta

🥂
View GitHub Profile
#
# rb_main.rb
# photouploader
#
# Created by orta on 26/03/2011.
# Copyright (c) 2011 http://www.ortatherox.com. All rights reserved.
#
# Loading the Cocoa framework. If you need to load more frameworks, you can
# do that here too.
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *js = [NSString stringWithFormat:@"var headID = document.getElementsByTagName('head')[0];var cssNode = document.createElement('link');cssNode.type = 'text/css';cssNode.rel = 'stylesheet';cssNode.href = '%@/override.css';cssNode.media = 'screen';headID.appendChild(cssNode);", baseURL];
[_webView stringByEvaluatingJavaScriptFromString:js];
body{
background-color:black !important;
}
@orta
orta / gist:1082537
Created July 14, 2011 14:20
objective C function to inject CSS from a local file into a webview
-(void)injectCSS {
NSString *path = [[NSBundle mainBundle] pathForResource:@"override" ofType:@"css"];
NSString * cssString = [NSString stringWithContentsOfFile:path encoding:NSASCIIStringEncoding error:nil];
cssString = [cssString stringByReplacingOccurrencesOfString:@"\n" withString:@""];
cssString = [cssString stringByReplacingOccurrencesOfString:@"\"" withString:@"'"];
NSString * js = [NSString stringWithFormat:@"$('head').append('<style>%@</style>');", cssString];
[webView stringByEvaluatingJavaScriptFromString:js];
}
@orta
orta / gist:1082540
Created July 14, 2011 14:20
objective C function to inject CSS from a local file into a webview
-(void)injectCSS {
NSString *path = [[NSBundle mainBundle] pathForResource:@"override" ofType:@"css"];
NSString * cssString = [NSString stringWithContentsOfFile:path encoding:NSASCIIStringEncoding error:nil];
cssString = [cssString stringByReplacingOccurrencesOfString:@"\n" withString:@""];
cssString = [cssString stringByReplacingOccurrencesOfString:@"\"" withString:@"'"];
NSString * js = [NSString stringWithFormat:@"$('head').append('<style>%@</style>');", cssString];
[webView stringByEvaluatingJavaScriptFromString:js];
}
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:~/spiel/zsh
@orta
orta / gist:1197277
Created September 6, 2011 11:05
Install your own copy of WibbleQuest
#!/usr/bin/ruby
def log(bit)
puts "\033[35m#{bit} \033[0m"
end
log "Creating a new Wibble project."
log "What folder would you like to put it in?"
folder = gets.chomp
{
// Delay in ms until autocompletion pops up after . or :: or ->
// Set to 0 to disable
"popup_delay": 100,
// Delay in ms until recompiling the file after the buffer is modified
// Set to 0 to disable
"recompile_delay": 1000,
// Whether or not to hide the clang output panel when it's empty
@orta
orta / post
Created December 29, 2011 17:44
my post script
#!/bin/bash
set -e
EDITOR=slime
TITLE=${1}
POSTDIR=_posts
EDITDIR=edit
cd /Users/orta/spiel/html/rebase
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color "branch"]