This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Waver | |
def initialize(filename) | |
@filename = File.expand_path(filename) | |
@byte_order = [] | |
@size = File.size @filename | |
open(@filename).each_byte{|ch| | |
@byte_order << ch | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
Earthquake.init do | |
command :zalgo do |m| | |
tw = "" | |
txt = m[1] | |
open("http://zalgo-text.jgate.de/convert?q=#{URI.encode(txt)}&max=20") do |r| | |
tw = r.read | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'sinatra' | |
module MyCustomRequestMethod | |
def hey(path,opts={},&blk) | |
route __method__.to_s.upcase,path,opts,&blk | |
end | |
end | |
module Sinatra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target InDesign | |
Function.prototype.before = function(){ | |
var fn = undefined; | |
var args = []; | |
for(var i=0; i<arguments.length; i++){ | |
if(i!=arguments.length-1){ | |
args.push(arguments[i]); | |
}else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target InDesign | |
//CS4でもCS5でもうごくぜ | |
DTP = this.DTP = { | |
text: "this is original" | |
} | |
alert(DTP.toSource()); | |
delete DTP; | |
if(!this.hasOwnProperty("DTP")){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'rbosa' ##gem install rubyosa or rubyosa19 | |
def playing | |
OSA.utf8_strings = true | |
itunes = OSA.app('iTunes') | |
if itunes.player_state == OSA::ITunes::EPLS::PLAYING | |
track = itunes.current_track | |
" ♪ "+track.artist.force_encoding("utf-8") + " - " + track.name.force_encoding("utf-8") | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
## is he/she a friend of mine plugin | |
Earthquake.init do | |
command :fom? do |m| | |
you, me = m[1], twitter.info['screen_name'] | |
if twitter.friends?(you,me) | |
puts "@#{you} is your friend" | |
else | |
input(":user #{you}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems/user_interaction' | |
class Jump | |
include Gem::UserInteraction | |
def ask_me | |
n = ask "key?" | |
end | |
def choose(lst) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import System.Process | |
getList :: String -> IO [String] | |
getList kwd = do lst <- readProcess "mdfind" query "" | |
return $ lines lst | |
where | |
query = ["kMDItemContentType == \"public.folder\" && kMDItemDisplayName == \"*" ++ kwd ++ "*\"wcd"] | |
-- マッチ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w(sinatra notify).each{|x| require x} | |
require "sinatra/reloader" if development? | |
configure do | |
TITLE = "InDesign Scripting Server" | |
INDESIGN_VERSION = "CS5" | |
end | |
get "/" do | |
Notify.notify TITLE, "Target Versiion InDesign #{INDESIGN_VERSION}" |