Skip to content

Instantly share code, notes, and snippets.

View tibbon's full-sized avatar

David Fisher tibbon

View GitHub Profile
@tibbon
tibbon / gist:4172823
Created November 30, 2012 00:12
Newest Twitter Friends Code
# In lib/twitter/api/friends_and_followers.rb
def friends(*args)
options = extract_options!(args)
merge_user!(options, args.pop || screen_name)
merge_default_cursor!(options)
cursor_from_response(:users, Twitter::User, :get, "/1.1/friends/list.json", options)
end
# In spec/twitter/api/friends_and_followers.rb
@tibbon
tibbon / gist:4428394
Created January 1, 2013 16:25
My Unicorn config file. Having crashy EOF issues with Postgres with workers.
# What the timeout for killing busy workers is, in seconds
timeout 60
# Whether the app should be pre-loaded
preload_app true
# How many worker processes
worker_processes 3
before_fork do |server, worker|

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

@tibbon
tibbon / gist:5474518
Created April 27, 2013 20:12
Non-working mtgox socket.io ruby code
require 'rubygems'
require 'socketIO'
client = SocketIO.connect("https://socketio.mtgox.com/mtgox") do
before_start do |f|
on_disconnect { p "disconnected"}
on_connect { p "connected" }
on_heartbeat { p "."}
on_message { |msg| p msg }
on_json_message { |json| p json}
@tibbon
tibbon / gist:5474524
Created April 27, 2013 20:14
Working Socket.io javascript code for mtgox
<html>
<head><head>
<body>
<script src="https://socketio.mtgox.com/socket.io/socket.io.js"></script>
<script>
var conn = io.connect('https://socketio.mtgox.com/mtgox');
conn.on('message', function(data) {
console.log(data);
});
</script>
@tibbon
tibbon / gist:5483076
Created April 29, 2013 17:09
yield inside a method
def test(x, func1, func2)
func1.call(x) do | y |
func2.call(y)
end
end
#change func1 to a method
def func1 x
for i in 1 .. 5
yield x * i
def test(x, get_user_ids, get_user_ids)
get_user_ids.call(x) do | y |
get_user_ids.call(y)
end
end
def get_user_ids x
for i in 1 .. 5
yield x * i
end
@tibbon
tibbon / gist:5614100
Created May 20, 2013 18:13
Chef/Vagrant issue
Macbook Pro:chef-guide tibbon$ rake start
vagrant up
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["--version"]
Stderr: dyld: Library not loaded: /Applications/VirtualBox.app/Contents/MacOS/VBoxRT.dylib
Referenced from: /Applications/VirtualBox.app/Contents/MacOS/VBoxManage
Reason: no suitable image found. Did find:
@tibbon
tibbon / gist:5695283
Last active December 18, 2015 00:18
Programming things I want to Learn- 2013 Edition
This should probably be a blog post, but if I do that then I want to make it readable to others.
Anyway, I want to get more awesome at the following things (which I already know a bit about each)
- C
- Haskell
- Go
- Python
- Javascript
- Postgres
@tibbon
tibbon / gist:5794257
Created June 17, 2013 02:08
Linux Bash Examples
Macbook Pro:bash_example tibbon$ ls
hello_world.rb lib
Macbook Pro:bash_example tibbon$ ls -al
total 0
drwxr-xr-x 4 tibbon staff 136 Jun 16 22:05 .
drwxr-xr-x 151 tibbon staff 5134 Jun 16 22:04 ..
-rw-r--r-- 1 tibbon staff 0 Jun 16 22:05 hello_world.rb
drwxr-xr-x 3 tibbon staff 102 Jun 16 22:05 lib
Macbook Pro:bash_example tibbon$ cd lib
Macbook Pro:lib tibbon$ ls