Skip to content

Instantly share code, notes, and snippets.

View jcxplorer's full-sized avatar

João Cardoso jcxplorer

View GitHub Profile
@jcxplorer
jcxplorer / gist:9682262
Created March 21, 2014 08:56
keybase.md
### Keybase proof
I hereby claim:
* I am jcxplorer on github.
* I am jcxplorer (https://keybase.io/jcxplorer) on keybase.
* I have a public key whose fingerprint is FCE8 AD88 8BE1 9093 8CF7 5657 0629 A3C5 C936 6F13
To claim this, I am signing this object:
@jcxplorer
jcxplorer / gist:5068603
Created March 1, 2013 22:53
Username search Regex tested to work with Ruby and iOS's NSRegularExpression
/(?<=^|[^a-z0-9_])@([a-z0-9_]+)/i
TenFarms.Views.Search = Backbone.View.extend({
initialize: function() {
this.$("input[type='text']").autocomplete({
appendTo: this.$(".dropdown"),
source: this._source
});
}
});
@jcxplorer
jcxplorer / gist:2556905
Created April 30, 2012 09:43
Compiling Vim
./configure --enable-rubyinterp --enable-pythoninterp --disable-gui --without-x --enable-multibyte --with-features=huge --prefix=/usr/local --disable-nls --with-tlib=ncurses
require "carpentry/no_robots_middleware"
module Carpentry
class Engine < ::Rails::Engine
config.app_middleware.use NoRobotsMiddleware
end
end
@jcxplorer
jcxplorer / uuid.js
Created February 12, 2011 16:58
UUID v4 generator in JavaScript (RFC4122 compliant)
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
if [[ -n "$PS1" ]]; then
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@jcxplorer
jcxplorer / nginx.conf
Created December 5, 2010 14:13
Simple nginx configuration
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
@jcxplorer
jcxplorer / nginx
Created November 3, 2010 14:01
Nginx init script for Ubuntu with Passenger.
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using its daemon
class Admin::AdministrationController < ActionController::Base
inherit_resources
before_filter :authenticate_admin!
protected
def resource
resource = super
def resource.sanitize_for_mass_assignment(attrs)
attrs