Skip to content

Instantly share code, notes, and snippets.

require 'net/http'
class HttpClient
def initialize(base_url, username = nil, password = nil)
@base_url = base_url
@username = username
@password = password
end
def get(path, headers = {})
@zh
zh / learn.lua
Last active August 29, 2015 14:19 — forked from tylerneylon/learn.lua
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
#!/usr/bin/env ruby
# Ping.fm to Rejaw Custom URL Script
#
# Before you can use, you will need to add the path of this file to
# the custom URL settings in your Ping.fm account: http://ping.fm/custom/.
#
# For further information on custom URL integration, check out the awesome help
# page: http://ping.fm/custom/help/
#
require "rubygems"
require "mechanize"
require "singleton"
LOGIN = 'http://edno23.mobi/login'.freeze
POST = 'http://edno23.mobi/post'.freeze
USER = 'username'.freeze
PASS = 'password'.freeze
class Edno23
@zh
zh / api.rb
Created September 11, 2008 08:19
TOKEN = 'MY_SECRET'.freeze
class ApiController < Ramaze::Controller
map '/api'
def index t=nil
if t && (TOKEN == t) && request.post?
Edno23.login('username','password')
Edno23.post(request[:message])
@zh
zh / gist:11369
Created September 18, 2008 04:06
--- scripts/maildaemon.php 2008-09-18 12:58:39.000000000 +0900
+++ /var/www/laconica/scripts/maildaemon.php.new 2008-09-18 13:01:01.000000000 +0900
@@ -30,6 +30,7 @@
require_once(INSTALLDIR . '/lib/common.php');
require_once(INSTALLDIR . '/lib/mail.php');
require_once('Mail/mimeDecode.php');
+require_once('Mail/RFC822.php');
# FIXME: we use both Mail_mimeDecode and mailparse
# Need to move everything to mailparse
@zh
zh / gist:11365
Created September 18, 2008 03:39
--- maildaemon.php 2008-09-18 12:11:19.000000000 +0900
+++ maildaemon.php.new 2008-09-18 12:36:11.000000000 +0900
@@ -29,6 +29,7 @@
require_once(INSTALLDIR . '/lib/common.php');
require_once(INSTALLDIR . '/lib/mail.php');
+require_once('Mail/RFC822.php');
require_once('Mail/mimeDecode.php');
# FIXME: we use both Mail_mimeDecode and mailparse
@zh
zh / xsend.rb
Created December 3, 2008 07:19
#!/usr/bin/env ruby
require 'rubygems'
require 'xmpp4r'
include Jabber
unless ARGV[0]
p "Usage: #{$0} MSG"
exit
#!/usr/bin/env ruby
#
# Purpose: Simple web form to send messages via XMPP to juick.com
# Usage: ruby rack2juick.rb and point your browser to
# http://127.0.0.1:9292/
require 'rubygems'
require 'rack'
require 'rack/request'
require 'rack/response'
#!/usr/bin/env ruby
#
# Purpose: Simple web form to send messages via XMPP to juick.com
# Usage: ruby rack2juick.rb and point your browser to
# http://127.0.0.1:9292/
# user: user, password: secret
require 'rubygems'
require 'rack'
require 'rack/request'