Skip to content

Instantly share code, notes, and snippets.

github = GitHub.new
gist = github.create_application('gist')
gist.make_most_awesome_paste_site!
@melborne
melborne / Hilite.rb
Created July 23, 2008 01:41
make a html file with syntax highlighting
#!/usr/bin/env ruby
require "rubygems"
require "uv"
class Hilite
BGCOLORS = {"all_hallows_eve" => {:bg => '#000000', :fg => '#ffffff'},
"amy" => {:bg => '#200420', :fg => '#d1d0ff'},
"blackboard" => {:bg => '#0d1021', :fg => '#f8f8f8'},
"brilliance_black" => {:bg => '#0d0d0d', :fg => '#cccccc'},
"brilliance_dull" => {:bg => '#0a0a0a', :fg => '#cdcdcd'},
#marginInset {
margin: 15px;
border: medium solid white
}
@cooldaemon
cooldaemon / udp_server.erl
Created July 23, 2008 01:53
This is udp server framework for Erlang.
%% @author Masahito Ikuta <cooldaemon@gmail.com> [http://d.hatena.ne.jp/cooldaemon/]
%% @copyright Masahito Ikuta 2008
%% @doc UDP Server Behaviour.
%% Copyright 2008 Masahito Ikuta
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
class Default
def add ; action( :create ) and redirect( paths.show ) ; end
def update
action( :update, name ) and redirect( resource( :site ).paths.main )
end
def delete
action( :delete, name ) and redirect( resource( :site ).paths.main )
end
def edit ; action( :find, name ) and render( :editor ) } ; end
def show ; action( :find, name ) and render( :show ) ; end
em httpclient
POST /messages/create HTTP/1.1
Content-length: 125
Host: localhost:3333
Authorization: Basic cGVuZ3VpbjpwbTMwMDI=
User-agent: Ruby EventMachine
Content-type: application/x-www-form-urlencoded
firefox
"\e[B": history-search-forward
"\e[A": history-search-backward
// ==========================================================================
// Welcome
// ==========================================================================
Welcome = SC.Object.create({
// This will create the server for your application. Add any namespaces
// your model objects are defined in to the prefix array.
server: SC.Server.create({ prefix: ['Welcome'] }),
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'rubygems'
require 'json'
require 'pp'
url = 'http://www.apple.com/retail/iphone/feeds/3g_us_inv.json'
json = Net::HTTP.get_response(URI.parse(url)).body
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'rubygems'
require 'json'
require 'pp'
url = 'http://www.apple.com/retail/iphone/feeds/3g_us_inv.json'
json = Net::HTTP.get_response(URI.parse(url)).body