Skip to content

Instantly share code, notes, and snippets.

@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: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 / YAPC-AjaxTesting.markdown
Created October 18, 2010 05:20
private log at YAPC Asia

Ajax Testing

  • Web+DB vol.59 嫁

JSTAPd

alternatives

#!/bin/sh
osascript <<'APPLESCRIPT'
tell application "Safari"
tell its first document
set its URL to (get its URL)
end tell
end tell
APPLESCRIPT
require Dir::pwd + "/../twsvr"
require "bacon"
require "rack/test"
class Bacon::Context
include Rack::Test::Methods
def app
Sinatra::Application
end
-- code
display dialog "Welcome to AppleScript."
-- declare & initialize a variable
set myName to "John"
copy 33 to myAge
-- objects
startup disk -- built-in object
@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]
@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"})
#!/usr/bin/env ruby
$LOAD_PATH << "#{ENV["TM_SUPPORT_PATH"]}/lib"
require "web_preview"
class SymfonyLimeTest
attr_reader :root_dir, :test_file
def initialize(args=ENV)
@sousk
sousk / encode cliped URL
Created May 12, 2010 09:36
escape your copied url string
echo `pbpaste` | ruby -e 'require "uri";print $<.gets.chomp!.gsub!(/([^\/]+)/){|m| URI.escape(m)}' | pbcopy