Skip to content

Instantly share code, notes, and snippets.

@NeoCat
NeoCat / chirp.js
Created September 25, 2010 05:40
Streaming API plugin and proxy server for twicli
var chirp_cnt = 0;
function update() {
if (!myname) return auth();
callPlugins("update");
if (chirp_cnt++ == 0)
update_ele = loadXDomainScript(twitterAPI + 'statuses/home_timeline.json' +
'?count=' + (since_id ? 200 : max_count) +
'&suppress_response_codes=true&callback=twShow', update_ele);
else
update_ele = loadXDomainScript('http://localhost:10080/?seq='+ (seq++) +
@NeoCat
NeoCat / tweet_URL_with_twicli.js
Created October 9, 2010 01:52
Open twicli and input tweet with current URL and title
javascript:void(window.open('http://twicli.neocat.jp/twicli.html?status="'+encodeURIComponent(document.title)+'":%20'+location.href,'twicli'))
#!/usr/bin/ruby
require 'pty'
Signal.trap(:CHLD, 'IGNORE')
system "stty raw -echo 2> /dev/null"
p = PTY.spawn '/bin/sh'
until p[0].closed? || STDIN.closed?
s = IO.select [p[0], STDIN]
@NeoCat
NeoCat / test.html
Created February 6, 2011 12:29
Test for double onload of iframe in Opera with oAutoPagerize.js
<html>
<head>
<script>
function test() {
var ifr = document.createElement("iframe");
document.body.appendChild(ifr);
ifr.onload = function(){ document.getElementById("log").innerHTML += "onload " }
ifr.contentWindow.document.write('');
ifr.contentWindow.document.close();
};
@NeoCat
NeoCat / toptracks.html
Created March 9, 2011 11:45
get toptracks of artist using last.fm API
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>last.fm API test</title>
<script>
var api_key = '0809689c938abf942a0d980ff25b5689';
var api_url = "http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&api_key="+api_key+"&format=json&autocorrect=1&artist=";
function $(id) { return document.getElementById(id); }
@NeoCat
NeoCat / share-input.rb
Created April 29, 2011 21:13
Share input within multiple terminals
#!/usr/bin/ruby
# share-input.rb: share input within multiple terminals
# Author: NeoCat
require 'socket'
require 'pty'
require "thread"
require "curses"
def server(sock, sock_name)
puts "relay server started."
@NeoCat
NeoCat / Bookmarklet.js
Created May 15, 2011 09:06
Send 'Chrome to Phone' request usig CGI and bookmarklet
javascript:window.open('http://localhost/utils/chrome2phone.cgi?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href),%20'_blank',%20'width=200,height=100');undefined;
@NeoCat
NeoCat / multi_column.css
Created July 30, 2011 18:32
user CSS for twicli - multi columns view sample
.tw-parent > div > div { width: 400px; float: left; }
#tw { left:0; }
#re { left:402px; }
#tw2 {left:804px; }
#menu { left: 804px; }
.tw-parent, #tw2 { width: 400px; height: 92%; overflow: scroll; display: block !important; }
a#TL, a#reply { display: none; }
@NeoCat
NeoCat / gtest.html
Created September 16, 2011 00:01
Google+ API JavaScript Sample
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Google+ API Test</title>
</head>
<body>
<button onclick="authBegin()">Login</button><br>
<button onclick="getPublicActivities($('user').value)">Get activities of user </button><input id="user" size="10" value="me"><br>
@NeoCat
NeoCat / count-window.sh
Created December 6, 2011 16:22
Count windows of the specified application in MacOS X
#!/bin/sh
osascript -e 'tell application "System Events"
try
count every window of process "'"$1"'"
on error
0
end try
end tell' 2>/dev/null