Skip to content

Instantly share code, notes, and snippets.

@sousk
sousk / Activate Application.scpt
Created May 30, 2010 05:32
this is the Quicksilver Action to activate application.
using terms from application "Quicksilver"
on process text t
my ActivateApp(t)
end process text
end using terms from
on ActivateApp(t)
tell application t
activate
menu_click({t, "Window", "Bring All to Front"})
@sousk
sousk / viewController.m
Created June 23, 2010 23:24
call UIActionSheet on pressing UIBarButton at iOS
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(showAddOptions)] autorelease];
self.navigationItem.rightBarButtonItem = addButton;
}
- (void) showAddOptions {
NSString *sheetTitle = [[NSString alloc]
-- code
display dialog "Welcome to AppleScript."
-- declare & initialize a variable
set myName to "John"
copy 33 to myAge
-- objects
startup disk -- built-in object
require Dir::pwd + "/../twsvr"
require "bacon"
require "rack/test"
class Bacon::Context
include Rack::Test::Methods
def app
Sinatra::Application
end
#!/bin/sh
osascript <<'APPLESCRIPT'
tell application "Safari"
tell its first document
set its URL to (get its URL)
end tell
end tell
APPLESCRIPT
@sousk
sousk / YAPC-AjaxTesting.markdown
Created October 18, 2010 05:20
private log at YAPC Asia

Ajax Testing

  • Web+DB vol.59 嫁

JSTAPd

alternatives

@sousk
sousk / gist:754067
Created December 24, 2010 09:41
fire event after images loaded
var
starter = $('#base img'),
th = starter.length,
cnt = 0;
starter.one("load",function(){
(++cnt >= th) && run();
})
.each(function(){
if(this.complete) starter.trigger("load");
@sousk
sousk / gist:762552
Created January 2, 2011 14:02
enable to launch stable/beta/dev chrome. source: http://d.hatena.ne.jp/os0x/20110101/1293831128
#!/usr/bin/env osascript
do shell script "/Applications/Chromes/dev/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromeDev > /dev/null 2>&1 &"
@sousk
sousk / gist:765757
Created January 5, 2011 01:01
Android Version Detection
app.is_android2p2 = (navigator.userAgent ||"").search(/Android\s*2.2/) > -1 ? true:false;
@sousk
sousk / gist:782303
Created January 17, 2011 00:30
colorize screen log
エンジニアの人って割と白黒のログ眺めてる人が多い気がしますが、僕は何かと色つけたい派ですね。
bash に
ctail(){ tail -f $1 | perl -pe 's/'$2'/\033\[1;35m$&\033\[0m/gi'; }
と書いて
ctail /var/log/system.log "(error|exception|unable)"
とかやってます