Skip to content

Instantly share code, notes, and snippets.

View hectoregm's full-sized avatar

Hector E. Gomez Morales hectoregm

View GitHub Profile
@hectoregm
hectoregm / rdoc_example.rb
Created October 10, 2011 18:11
Rdoc Template
#
#
# * *Args* :
# - ++ ->
# * *Returns* :
# -
# * *Raises* :
# - ++ ->
#
def method_name
@hectoregm
hectoregm / require.rb
Created October 15, 2011 22:28
require
require File.expand_path(File.join(File.dirname(__FILE__), 'filename'))
# Or only for ruby 1.9
require_relative 'filename'
@hectoregm
hectoregm / escape_c.txt
Created November 15, 2011 19:30
C Escape Sequences
Escape Sequence Name Meaning
\a Alert Produces an audible or visible alert.
\b Backspace Moves the cursor back one position (non-destructive).
\f Form Feed Moves the cursor to the first position of the next page.
\n New Line Moves the cursor to the first position of the next line.
\r Carriage Return Moves the cursor to the first position of the current line.
\t Horizontal Tab Moves the cursor to the next horizontal tabular position.
\v Vertical Tab Moves the cursor to the next vertical tabular position.
\' Produces a single quote.
\" Produces a double quote.
@hectoregm
hectoregm / gist:1401897
Created November 28, 2011 20:30
Regexp, Ruby and You

Regular Expressions: The Good Parts (Ruby Edition)

Introduction

So what are regular expressions?, Wikipedia has a nice [definition][1]:

Regular expressions provides a concise and flexible means for "matching" (specifying and recognizing) strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp".

@hectoregm
hectoregm / ruby_debug_pow.markdown
Created February 9, 2012 04:48 — forked from alexagui/ruby_debug_pow.markdown
How to Ruby Debug with Pow

How to Ruby Debug with Pow

Below are steps I followed to get ruby debugger ruby-debug running with Pow. Based on info from this thread basecamp/pow#43 and this blog post http://flochip.com/2011/04/13/running-pow-with-rdebug/

1) Update your Gemfile

Assuming you're writing your app in Ruby 1.9 and using Bundler, just add the dependency to your development gems:

@hectoregm
hectoregm / 1-view-events.js
Created February 25, 2012 01:09 — forked from mxriverlynn/1-view-events.js
zombies! run!
MyView = Backbone.View.extend({
events: {
"click #someButton": "doThat",
"change #someInput": "changeIt"
},
doThat: function(){ ... },
changeIt: function(){ ... }
});
@hectoregm
hectoregm / ruby_gc.sh
Created September 5, 2012 05:25 — forked from mikhailov/ruby_gc.sh
Ruby’s GC Configuration
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@hectoregm
hectoregm / nginx.conf
Created September 8, 2012 20:01 — forked from thewebfellas/nginx.conf
sample nginx.conf for thin
user nginx;
worker_processes 5;
error_log /var/log/nginx.error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@hectoregm
hectoregm / ruby_gc.sh
Created September 9, 2012 03:20 — forked from mikhailov/ruby_gc.sh
Ruby’s GC Configuration
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@hectoregm
hectoregm / gist:3881407
Created October 12, 2012 20:47 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt