Skip to content

Instantly share code, notes, and snippets.

@kavu
kavu / README.rdoc
Created January 4, 2010 13:48 — forked from woodie/README.rdoc

Rails 2.3.5 on App Engine

We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.5 calls to rubygems, and now we have it working. Rails 2.3.5 currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.

Install the Development Environment

The gems for the development environment include a pre-release appengine-tools gem that provides a pre-release version of jruby-rack.

sudo gem install google-appengine
sudo gem install appengine-tools --pre
module Paperclip
class Attachment
class UploadedPath
attr_reader :original_filename, :content_type, :size, :path
def initialize(uploaded_file)
@original_filename = uploaded_file["name"].downcase
@content_type = uploaded_file["content_type"].to_s.strip
@file_size = uploaded_file["size"].to_i
@path = uploaded_file["path"]
This example shows how to setup an environment running Rails 3 beta 3 under 1.9.2-head with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.2-head
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.2-head@rails3
diff -up ext/openssl/ossl.c.ossl10 ext/openssl/ossl.c
--- ext/openssl/ossl.c.ossl10 2007-02-13 00:01:19.000000000 +0100
+++ ext/openssl/ossl.c 2009-08-26 12:29:41.000000000 +0200
@@ -92,7 +92,7 @@ ossl_x509_ary2sk(VALUE ary)
#define OSSL_IMPL_SK2ARY(name, type) \
VALUE \
-ossl_##name##_sk2ary(STACK *sk) \
+ossl_##name##_sk2ary(STACK_OF(type) *sk) \
{ \

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
-module(slugs).
-export([slugify/1]).
-define(tolower(C), (C+32)).
-define(islower(C), (C >= $a andalso C =< $z)).
-define(isupper(C), (C >= $A andalso C =< $Z)).
-define(isdigit(C), (C >= $1 andalso C =< $9)).
-define(isspace(C), (
C =:= $\s orelse C =:= $\n orelse C =:= $\t orelse C =:= $\r
## MAC OS
.DS_Store
## TEXTMATE
*.tmproj
tmtags
## EMACS
*~
\#*
Building native extensions. This could take a while...
ERROR: Error installing memprof:
ERROR: Failed to build gem native extension.
/home/kavu/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby extconf.rb
checking for main() in -lyajl_ext... yes
checking for json/json_gen.h... yes
checking for gelf_getshdr() in -lelf_ext... yes
checking for main() in -ldwarf_ext... yes
checking for mach-o/dyld.h... no
@kavu
kavu / main.c
Created January 26, 2011 14:25
#include <stdio.h>
#include <string.h>
#include <ctype.h>
static char buf[] = "the world helorow";
static void revstr(char *start, char *end) {
register char temp;
while(start < end) {
temp = *start;