Skip to content

Instantly share code, notes, and snippets.

View yoko's full-sized avatar
🍐
I like pear

yksk yoko

🍐
I like pear
View GitHub Profile
on url_encode(str)
set ret to do shell script "ruby -e \"require 'uri'; print URI.encode('" & str & "', Regexp.new(\\\"[^#{URI::PATTERN::UNRESERVED}]\\\"))\""
return ret
end url_encode
tell application "BathyScaphe"
set _text to selected text of document 1
set _title to title of document 1
set _url to URL of document 1
end tell
package {
import flash.display.Sprite;
import flash.external.ExternalInterface;
[SWF(frameRate=1, background=0x000000)]
public class Hello extends Sprite {
public function Hello() {
ExternalInterface.marshallExceptions = true;
ExternalInterface.addCallback('hello', function():String {
(function($) {
$.support.dataSchema = (
$.browser.msie && $.browser.version >= 8 || !$.browser.msie
);
})(jQuery);
function FindProxyForURL(url, host) {
var proxy = 'localhost:5432';
var domain = 'example.com';
return (dnsDomainIs(host, domain) && shExpMatch(url, '*.js')) ?
'PROXY '+proxy :
'DIRECT';
}
javascript:alert(prompt('Reverse!').split('').reverse().join(''));
require 'rubygems'
require 'httpclient'
require 'pit'
def growl(title, message, options = {})
arg = ''
options.each {|k, v| arg << " --#{k}" + (v == true ? '' : " \"#{v}\"") }
`/usr/local/bin/growlnotify -t "#{title}" -m "#{message}"#{arg}`
end
@yoko
yoko / cycle.js
Created January 28, 2010 07:56
setInterval controller
var Cycle = function(interval) {
if (interval) this.interval = interval;
};
Cycle.prototype = {
queue : null,
timer : null,
interval : 500,
start_time: 0,
start: function() {
$.support.dataSchema = ($.browser.msie && $.browser.version >= 8 || !$.browser.msie);
$.support.console = !(!window.console || !window.console.log);
@yoko
yoko / gist:299086
Created February 9, 2010 10:43
Import Flash Video to iTunes
on run {input, parameters}
repeat with f in input
try
tell application "Finder" to set file type of file f to "MooV"
end try
end repeat
tell application "iTunes" to add input
return input
end run
#!/usr/bin/env ruby
require 'rubygems'
require 'sequel'
require 'google_chart'
require 'open-uri'
(size, color) = *ARGV
size = size || '640x240'
color = color || 'a8bccb'