Skip to content

Instantly share code, notes, and snippets.

View fernyb's full-sized avatar

Fernando Barajas fernyb

View GitHub Profile
URI.encode("hello world") #=> "hello%20world"
CGI.escape("hello world") #=> "hello+world"
CGI.escape("Hello~world") #=> "Hello%7Eworld"
URI.encode("Hello~world") #=> "Hello~world"
class Transaction
attr_accessor :transaction_id
attr_accessor :url
SIGNATURE_KEYNAME = "Signature"
SIGNATURE_METHOD_KEYNAME = "SignatureMethod"
SIGNATURE_VERSION_KEYNAME = "SignatureVersion"
HMAC_SHA256_ALGORITHM = "HmacSHA256"
HMAC_SHA1_ALGORITHM = "HmacSHA1"
ffmpeg:
./configure --prefix=/usr/local/ffmpeg \
--disable-yasm \
--enable-shared \
--enable-libmp3lame \
--enable-libx264 \
--enable-libxvid \
--enable-libfaac \
--enable-libtheora \
@fernyb
fernyb / nginx
Created February 11, 2013 21:55
nginx service start up
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu or other *nix.
# Description: nginx init.d dash script for Ubuntu or other *nix.
### END INIT INFO
./configure --prefix='/usr/local/nginx' --with-http_ssl_module --add-module='/usr/local/ruby-1.9.2-p136/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/nginx' --add-module=/sources/nginx-files/nginx-rtmp-module
ab -n 10000 -c 100 -T "application/json; charset=utf-8" http://localhost:3000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
# Ember.js View routes
App.Router.router.recognizer.names
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
@fernyb
fernyb / gist:5086701
Created March 4, 2013 23:44
Backbone use "{{" "}}" instead of "<%" "%>"
_.templateSettings = {
interpolate: /\{\{\=(.+?)\}\}/g,
evaluate: /\{\{(.+?)\}\}/g
};