Skip to content

Instantly share code, notes, and snippets.

View fervic's full-sized avatar

Roberto Fernandez fervic

View GitHub Profile
@fervic
fervic / errs.go
Created January 7, 2016 07:16
Golang error checking closure
func httpRequestHandler(w http.ResponseWriter, req *http.Request) {
err := func () os.Error {
if req.Method != "GET" {
return os.NewError("expected GET")
}
if input := parseInput(req); input != "command" {
return os.NewError("malformed command")
@fervic
fervic / sunrise-and-nicoulaj-zsh-theme.md
Last active June 21, 2017 20:22
This theme combines nicoulaj simplicity with sunrise Git status codes
@fervic
fervic / remove_class_regex.js
Created April 18, 2015 21:12
Romove class by regex jQuery extension
//------------------------------------------------------------------------------
// Remove class by Regex
// Array.filter for IE<9: https://gist.github.com/eliperelman/1031656
[].filter||(Array.prototype.filter=function(a,b,c,d,e){c=this;d=[];for(e in c)~~e+''==e&&e>=0&&a.call(b,c[e],+e,c)&&d.push(c[e]);return d});
// http://stackoverflow.com/a/18621161
$.fn.removeClassRegex = function(regex) {
return $(this).removeClass(function(index, classes) {
return classes.split(/\s+/).filter(function(c) {