Skip to content

Instantly share code, notes, and snippets.

CmdUtils.CreateCommand({
name: "flip",
execute: function(){
var doc = CmdUtils.getDocument();
jQuery(doc.body).css("-moz-transform", "rotate(180deg)");
}
});
CmdUtils.CreateCommand({
@kavu
kavu / chat.rb
Created July 10, 2009 22:53 — forked from maxlapshin/chat.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'active_support'
require 'haml'
require 'thin'
gem 'tmm1-amqp'
require 'mq'
@kavu
kavu / gist:175837
Created August 26, 2009 20:58 — forked from skammer/gist:175684
// replaced this
$(document).ready(function() {
if ($.fn.corner) $('.corner').corner()
})
// with this
.corner {
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
padding: 3px;
@kavu
kavu / deploy.rb
Created November 18, 2009 10:58 — forked from kpumuk/deploy.rb
namespace :deploy do
desc 'Bundle and minify the JS and CSS files'
task :precache_assets, :roles => :app do
root_path = File.expand_path(File.dirname(__FILE__) + '/..')
jammit_path = Dir["#{root_path}/vendor/gems/jammit-*/bin/jammit"].first
yui_lib_path = Dir["#{root_path}/vendor/gems/yui-compressor-*/lib"].first
assets_path = "#{root_path}/public/assets"
# Precaching assets
run_locally "ruby -I#{yui_lib_path} #{jammit_path}"
it 'should allow JPG images' do
photo = Photo.new :photo => fixture_file_upload('photos/chameleon.jpg', 'image/jpeg')
photo.stub!(:save_attached_files).and_return true
photo.save.should be_true
end
@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: