Skip to content

Instantly share code, notes, and snippets.

Avatar

Don Park donpdonp

View GitHub Profile
View gist:110240
{"title":"","id":1,"dateAdded":1212775990209648,"lastModified":1240358990501541,"type":"text/x-moz-place-container","root":"placesRoot","children":[{"title":"Bookmarks Menu","id":2,"parent":1,"dateAdded":1212775990209953,"lastModified":1242084173958231,"type":"text/x-moz-place-container","root":"bookmarksMenuFolder","children":[{"title":"Recently Bookmarked","id":7,"parent":2,"annos":[{"name":"Places/SmartBookmark","flags":0,"expires":4,"mimeType":null,"type":3,"value":"RecentlyBookmarked"}],"type":"text/x-moz-place","uri":"place:folder=BOOKMARKS_MENU&folder=UNFILED_BOOKMARKS&folder=TOOLBAR&sort=12&excludeQueries=1&excludeItemIfParentHasAnnotation=livemark%2FfeedURI&maxResults=10&queryType=1"},{"index":1,"title":"Recent Tags","id":8,"parent":2,"annos":[{"name":"Places/SmartBookmark","flags":0,"expires":4,"mimeType":null,"type":3,"value":"RecentTags"}],"type":"text/x-moz-place","uri":"place:sort=14&type=6&maxResults=10&queryType=1"},{"index":2,"title":"","id":9,"parent":2,"dateAdded":1212775990220508,"type":"t
View gist:151507
#!/usr/bin/env ruby
require 'rexml/document'
require 'net/http'
require 'time'
def get_tweets(user,pass,page)
Net::HTTP.start('www.twitter.com') {|http|
req = Net::HTTP::Get.new("/statuses/user_timeline.xml?count=200?page=#{page}")
req.basic_auth user, pass
response = http.request(req)
View gist:151508
#!/usr/bin/env ruby
require 'rexml/document'
require 'net/http'
require 'time'
def get_tweets(user,pass,page)
Net::HTTP.start('www.twitter.com') {|http|
req = Net::HTTP::Get.new("/statuses/user_timeline.xml?count=200?page=#{page}")
req.basic_auth user, pass
response = http.request(req)
View gist:186896
module States
STATES = %w(cancelled declined passive active approved pending flagged complete)
attr_accessor :state # remove this if using an activerecord column
def self.included(mod)
STATES.each do |state|
up_state = state.upcase
mod.const_set(up_state, state)
mod.send(:define_method, state+'?') do
View gist:186916
module States
STATES = %w(cancelled declined passive active approved pending flagged complete)
attr_accessor :state # remove this if using an activerecord column
STATES.each do |state|
const_set(state.upcase, state)
define_method(state+'?') do
self.state == state
end
View gist:189427
root@OpenWrt:~# lspci
00:00.0 Host bridge: Broadcom Corporation BCM5365P Sentry5 Host Bridge
00:01.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
00:02.0 USB Controller: NEC Corporation USB (rev 43)
00:02.1 USB Controller: NEC Corporation USB (rev 43)
00:02.2 USB Controller: NEC Corporation USB 2.0 (rev 04)
root@OpenWrt:~# dmesg
Linux version 2.6.25.20 (andy@stable-sandbox) (gcc version 4.1.2) #3 Mon Sep 14 09:03:26 UTC 2009
View gist:358343
<% menu_options = [:root => "Home", :blog => "Blog"] %>
<% menu_options.each do |k,v| %>
<li>
<%= link_to v,
send(k.to_s+"_index_path"),
{}.merge(:class => "something") if controller.name == k) %>
</li>
<% end %>
View gist:372933
$ gem sources
*** CURRENT SOURCES ***
http://rubygems.org
View json format for geo data
Common minimal format for sending just lat/long data
[
{
uuid: "550e8400-e29b-41d4-a716-446655440000",
date: "2010-04-30T16:50:00Z",
location: {
position: {
geojson: { "type": "Point",
"coordinates": [11.0, 61.0] }
}
View gist:428003
E/AndroidRuntime( 3355): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 3355): java.lang.RuntimeException: Unable to create service com.icecondor.nest.Pigeon: android.content.res.Resources$NotFoundException: File res/raw/beep.mp3 from drawable resource ID #0x7f040000
E/AndroidRuntime( 3355): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2790)
E/AndroidRuntime( 3355): at android.app.ActivityThread.access$3200(ActivityThread.java:119)
E/AndroidRuntime( 3355): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
E/AndroidRuntime( 3355): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3355): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3355): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 3355): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3355): at java.lang.reflect.Method.invoke(Method.java:521)
You can’t perform that action at this time.