Skip to content

Instantly share code, notes, and snippets.

View milligramme's full-sized avatar

milligramme milligramme

View GitHub Profile
@milligramme
milligramme / lists.rb
Last active December 27, 2015 03:29 — forked from babie/lists.rb
module TwitterOAuth
class Client
def get_lists(user)
get("/lists/list.json?screen_name=#{user}")
end
end
end
module Earthquake::Input
def lists
Earthquake.init do
_ = config[:auto_restart] ||= {}
_[:interval] ||= 60 * 60
system "stty echo" # for readline
EM.defer do
sleep config[:auto_restart][:interval]
loop do
if Readline.line_buffer.nil? || Readline.line_buffer.empty?
Earthquake.init do
output do |item|
next unless item['text']
next unless config[:separator]
unless config[:screen_width]
begin
require 'curses'
screen = Curses.init_screen
config[:screen_width] = screen.maxx
@milligramme
milligramme / expand_tco.rb
Last active December 14, 2015 21:09 — forked from jaspertandy/expand_tco.rb
Timeline上の t.co を展開して表示する Earthquake.gem プラグイン
require "open-uri"
require "openssl"
Earthquake.init do
output_filter do |item|
next unless item['text']
text = item["text"]
text = item['retweeted_status']['text'] unless item['retweeted_status'].nil?
text.scan( /https?:\/\/t\.co\/[a-zA-Z0-9\-]+/ ).each do |url|
uri = URI.parse url
%w(sinatra/base json pygments).each{|x| require x}
inp = ARGF.read
jsn = JSON.pretty_generate(JSON.parse inp)
Sinatra.new{ get("/"){ "<style>#{Pygments.css}</style>#{Pygments.highlight(jsn, :lexer => 'json')}" }}.run!
@milligramme
milligramme / finder-open-iterm-here.scpt
Created January 25, 2012 06:34 — forked from cowboy/finder-open-iterm-here.scpt
Finder Open iTerm Here: Drop a folder on this script (or just run it) to open a new iTerm window there. If the selected item isn't a folder, it will open the item's parent folder. Great when bound to a hotkey in FastScripts or added to the Finder Sidebar
(*
* Finder Open iTerm Here - v1.0.2 - 4/14/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Finder"
@milligramme
milligramme / octocat.svg
Created July 1, 2011 13:42
Github octocat avatar, SVG format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(function(){
/*
* 2011.1.8 InDesign Script勉強会お題①
* CSV(二次元配列)の2番目と4番目をフレームに入れる
*/
var csv = [
["aaa1","bbb1","ccc1","ddd1"],
["aaa2","bbb2\rbbb2","ccc2","ddd2"],