Skip to content

Instantly share code, notes, and snippets.

View morygonzalez's full-sized avatar
🌴
I may be slow to respond.

Hitoshi Nakashima morygonzalez

🌴
I may be slow to respond.
View GitHub Profile
@youpy
youpy / love.rb
Created February 4, 2009 18:21
love ☆☆☆☆☆ track
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'json'
require 'pp'
require 'digest/md5'
require 'net/https'
require 'pit'
require 'cgi'
@bryanthompson
bryanthompson / cache_helper.rb
Created January 14, 2010 22:08
Simple fragment caching in sinatra
require 'sinatra/base'
class CacheHelper
module Sinatra
module Helpers
def cache(name, options = {}, &block)
if cache = read_fragment(name, options)
@_out_buf << cache
else
pos = @_out_buf.length
if(typeof(models)=='undefined')
this.models = models = new Repository();
var Pinboard = {
name : 'Pinboard',
ICON : 'http://pinboard.in/favicon.ico',
getCurrentUser : function() {
if(decodeURIComponent(getCookieString('pinboard.in', 'login')).match(/login=(.*?) /))
return RegExp.$1;
@koduki
koduki / ma.rb
Created October 30, 2010 17:18
# -*- encoding: utf-8 -*-
require 'rexml/document'
require 'net/http'
class MA
def initialize
path = File.join(File.dirname(__FILE__), "..", "config", "yahooapis.yml")
config = YAML::load(File.open(path))
@app_id = config['app_id']
end
@uasi
uasi / vim.rb
Created November 30, 2010 16:46
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@siyo
siyo / .tw
Created December 7, 2010 17:05
oreore twitter cli client
#
# this file format is YAML
#
acount_basic:
screen_name1:
user: screen_name1
password: password1
screen_name2:
user: screen_name2
password: password2
@siyo
siyo / itunescli.rb
Created December 18, 2010 17:34
my itunes cli
#!/usr/bin/env ruby
require 'kconv'
require 'rubygems'
require 'rbosa'
class ItunesCLI
COMMANDS = {
'next' => :next_track,
'n' => :next_track,
@youpy
youpy / .zshrc
Created February 1, 2011 14:09
play music during command execution
p() {
local pid exit
# http://www.filesonic.com/file/703099021
play -l ~/Music/Nyan\ Cat.mp3 &
pid=$!
trap "kill -9 $pid" INT
command $*
exit=$?
kill -9 $pid
trap INT
@youpy
youpy / script
Last active September 25, 2015 22:18
/Applications/Gyazo.app/Contents/Resources/script
#!/usr/bin/env ruby
require 'fileutils'
require 'digest/md5'
def main
file = File.expand_path("~/Dropbox/Public/g/#{Digest::MD5.hexdigest(Time.now.to_f.to_s)}.png")
url = 'https://dl.dropboxusercontent.com/u/334064/g/' + File.basename(file)
FileUtils.mkdir_p File.dirname(file)
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra/base'
require 'ruby-growl'
require 'launchy'
class GrowlServer < Sinatra::Base
set :port, 5678