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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# -*- ruby -*- | |
require 'spotlight' | |
require 'optparse' | |
predicates = ['(true)'] | |
usedate = false | |
usesize = false |
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
// only supports Safari | |
// https://github.com/wfarr/dotjs.safariextension | |
if($.browser.safari) { | |
var link = $('<link />'). | |
attr('href', 'http://dl.dropbox.com/u/334064/sketches/webfont_1/styles_min.css'). | |
attr('type', 'text/css'). | |
attr('rel', 'stylesheet'); | |
$('head').append(link); |
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
# this is integrated in netprint gem. | |
# https://github.com/youpy/netprint/commit/d4d43ad9cf7448d6ba047296efb18e89d1435905 |
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
--- actionscript-mode.el_ 2012-10-29 11:37:47.000000000 +0900 | |
+++ actionscript-mode.el 2012-10-29 11:42:52.000000000 +0900 | |
@@ -48,7 +48,12 @@ | |
(require 'font-lock) | |
(require 'cc-mode) | |
(eval-when-compile | |
- (require 'regexp-opt)) | |
+ (require 'regexp-opt) | |
+ (load "cc-fonts" nil t) | |
+ (load "cc-langs" nil t)) |
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(tmpdir netprint prawn).each {|g| require g } | |
Earthquake.init do | |
command :netprint do |m| | |
Dir.mktmpdir do |dir| | |
filename = dir + "/tweet.pdf" | |
Prawn::Document.generate(filename) do | |
font "/Users/youpy/Library/Fonts/M+2P+IPAG.ttf" | |
text m[1] | |
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' | |
require 'cgi' | |
def show_image_on_iterm(url) | |
filename = '/tmp/image_on_iterm' | |
system('curl %s > %s 2>/dev/null' % [url, filename]) | |
command =<<CMD % filename | |
osascript -e " | |
tell application \\"iTerm\\" | |
tell the first terminal |
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(nokogiri open-uri).each {|g| require g } | |
def extract_title(url) | |
open(url) do |f| | |
if f.content_type =~ /html/ | |
doc = Nokogiri::HTML(f) | |
title = doc.xpath('//title')[0] | |
title ? title.text : nil | |
end | |
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 'eventmachine-distributed-notification' | |
require 'ruby_gntp' | |
require 'json' | |
# EM.post_distributed_notification('growl_notify', msg) | |
EM.run { | |
EM.watch_distributed_notification('growl_notify') {|c| | |
(class << c; self; end).send(:define_method, :notify) {|name, info| | |
msg = info['data'] |
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 MIDIX | |
def initialize | |
@destinations = CoreMIDI::Destination.all | |
end | |
def program_change(program_number, channel = 0) | |
puts(0b11000000 | channel, program_number) | |
end | |
def control_change(control_number, value, channel = 0) |
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(v8 open-uri).each {|g| require g } | |
class ZWS | |
def initialize | |
@cxt = V8::Context.new | |
open("https://raw.github.com/youpy/node-zws/master/lib/zws.js") do |file| | |
@cxt.eval(file, "zws.js") | |
end | |
end |