Skip to content

Instantly share code, notes, and snippets.

View rc1021's full-sized avatar
🏠
Working from home

許益銘 rc1021

🏠
Working from home
View GitHub Profile
@xdite
xdite / gist:3106785
Created July 13, 2012 19:15
Speedup Rails Asset Pipeline precompile process
@betweenbrain
betweenbrain / gist:2284129
Created April 2, 2012 14:56
Git command to export only changed files between two commits
git archive --output=file.zip HEAD $(git diff --name-only SHA1 SHA2)
@hemanth
hemanth / js-best-practices.md
Created March 14, 2012 10:33 — forked from TheJase-Gist/js-best-practices.md
JavaScript best practices

JavaScript Best Practices

Code conventions

Closing/opening brackets

Although this isn't a problem in other languages, because of semicolon insertion, there could be problems if you don't place the bracket on the opening line:

// no:
function()
{
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@taf2
taf2 / media_uploader.js
Created June 7, 2011 16:43
MultiPart Form POST - Compatible with Uploading Files to S3
Ti.include("/lib/strftime.js");
// see: http://blog.odonnell.nu/posts/streaming-uploads-s3-python-and-poster/
function MediaLoader(user) {
this.user = user;
}
MediaLoader.prototype = {
// upload a file with some postData fields
//
// multipartUpload(host, port, "your_file_name", fileObject, [['field1','value'], ['field2','value']], function(p) { });
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@dira
dira / omniauth.rb
Created December 1, 2010 01:56
OmniAuth strategy for a custom provider
# config/initializers/omniauth.rb
module OmniAuth
module Strategies
# tell OmniAuth to load our strategy
autoload :Pixelation, 'lib/pixelation_strategy'
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, "app_name", "secret"