Skip to content

Instantly share code, notes, and snippets.

View gist:f27f4c3823845ef66e8b
% mkdir build
% cd build
~/git/ruby/build
% ../configure --without-tk --disable-install-doc
Downloading config.guess...
Downloading config.sub...
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
View gist:d5373bb96c5e21c83950
require 'httpclient'
# Obtain Personal access token from https://github.com/settings/applications
personal_access_token = ''
h = HTTPClient.new
h.set_auth(nil, personal_access_token, 'x-oauth-basic')
puts h.get_content('https://api.github.com/user/repos?type=private')
View jsonclient.rb
require 'httpclient'
require 'json'
module HTTP
class Message
# Returns JSON object of message body
alias original_content content
def content
if JSONClient::CONTENT_TYPE_JSON_REGEX =~ content_type
JSON.parse(original_content)
View patch for merging shugomaeda's entries
diff --git a/app/models/entry.rb b/app/models/entry.rb
index ccc375a..3ad8240 100644
--- a/app/models/entry.rb
+++ b/app/models/entry.rb
@@ -75,13 +75,12 @@ class Entry < Hash
end
def similar?(rhs)
- if self.identity == rhs.identity
- similar_title?(rhs)
View gist:72559
0% git diff app/controllers/entry_controller.rb
diff --git a/app/controllers/entry_controller.rb b/app/controllers/entry_controller.rb
index 296f596..568c7c8 100644
--- a/app/controllers/entry_controller.rb
+++ b/app/controllers/entry_controller.rb
@@ -465,7 +465,7 @@ private
def redirect_to_list
if ctx = @ctx || session[:ctx]
- redirect_to ctx.list_opt
@nahi
nahi / request.rb.lf.diff
Created Mar 8, 2009
for actionpack-2.2.2
View request.rb.lf.diff
--- lib/action_controller/request.rb.org 2009-02-27 22:50:53.000000000 +0900
+++ lib/action_controller/request.rb 2009-03-08 20:54:16.000000000 +0900
@@ -647,12 +647,22 @@ EOM
body.string.force_encoding(Encoding::BINARY) if body.string.respond_to?(:force_encoding)
end
- boundary_size = boundary.size + EOL.size
- body_size -= boundary_size
- status = body.read(boundary_size)
- if nil == status
- raise EOFError, "no content body"
@nahi
nahi / cgi.rb.lf.diff
Created Mar 8, 2009
for ruby_1_8 r22821
View cgi.rb.lf.diff
Index: cgi.rb
===================================================================
--- cgi.rb (リビジョン 22821)
+++ cgi.rb (作業コピー)
@@ -980,14 +980,24 @@
# start multipart/form-data
stdinput.binmode if defined? stdinput.binmode
- boundary_size = boundary.size + EOL.size
- content_length -= boundary_size
View sqlite3_api.i.diff
--- sqlite3_api.i.org 2008-05-25 12:52:41.000000000 +0900
+++ sqlite3_api.i 2009-03-16 20:45:51.000000000 +0900
@@ -159,9 +159,9 @@ typedef void RUBY_VALBLOB;
}
-%typemap(in) (const char * sql,int,sqlite3_stmt**,const char**) (sqlite3_stmt *stmt, char *errmsg) {
+%typemap(in) (const char * sql,int,sqlite3_stmt**,const char**) (sqlite3_stmt *stmt, char *remainder = NULL) {
$1 = RSTRING_PTR($input);
$2 = RSTRING_LEN($input);
$3 = &stmt2;
View trans_sid.diff
--- lib/jpmobile/trans_sid.rb.org 2009-03-24 23:16:07.000000000 +0900
+++ lib/jpmobile/trans_sid.rb 2009-03-24 23:16:14.000000000 +0900
@@ -26,5 +26,5 @@ module Jpmobile::TransSid #:nodoc:
return unless request # for test process
return unless apply_trans_sid?
- { session_key => session.id }
+ { session_key => request.session_options[:id] }
end
@@ -37,5 +37,5 @@ module Jpmobile::TransSid #:nodoc:
View ghi_with_proxy_hack.rb
require "httpclient"
module Net
class HTTP < Protocol
class << HTTP
def get(uri_or_host, path = nil, port = nil)
raise if path or port
HTTPClient.get_content(uri_or_host)
end
Response = Struct.new(:body)