Skip to content

Instantly share code, notes, and snippets.

View lcaballero's full-sized avatar

Lucas Caballero lcaballero

View GitHub Profile
@lcaballero
lcaballero / Create Form
Last active December 23, 2015 22:59
Create a form from input elements and attributes.
;(function($) {
/**
* Creates a form element that can be appended to the body. These
* are the default parameters that can be provided to this function
* via an options object:
*
* Options:
* {
* method: "post" | "get"
@lcaballero
lcaballero / Css Buttons Less Buttons
Created September 12, 2013 21:20
Css Buttons Less Buttons
.btn-sizing(@color:#fff, @radius: 3px, @padding_top: 4px, @padding_sides: 10px) {
font-weight: bold;
color:@color;
border-radius: @radius;
padding: @padding_top @padding_sides;
}
.btn-colors(@border: #660000, @top: #cb0000, @bottom: #9c0000) {
border: 1px solid @border;
.vertical-gradient(@top, @bottom);
@lcaballero
lcaballero / CSS selector finder
Created August 23, 2013 22:25
CSS rule finder and selector finder given an element.
; (function ($) {
function newSelectorInfo() {
return {
hrefs: [],
selectors: [],
matched: [],
skipped: [],
sortCssText: function () {
this.matched.sort(function (a, b) {
@lcaballero
lcaballero / cssParser
Created August 23, 2013 22:24
CSS Parser in JavaScript. Fork of cssParser (see the lisence and comments).
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
@lcaballero
lcaballero / Minimal common helper css
Created August 23, 2013 15:15
Minimal common helper css.
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
.hasLayout, .contain {
*zoom:1;
}
.contain:after {
content:".";
@lcaballero
lcaballero / Gist form of Eric Meyer's css reset
Last active December 21, 2015 14:29
Gist form of Eric Meyer's css reset.
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@lcaballero
lcaballero / Example Mapping Parameter Names to Call Values
Last active December 21, 2015 13:08
Example Mapping Parameter Names to Call Values
;(function() {
var slice = Array.prototype.slice
var console = window["console"] || {console:{}};
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
function getParamNames(func) {
var fnStr = func.toString().replace(STRIP_COMMENTS, '')
var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(/([^\s,]+)/g)
if(result === null)
result = []
@lcaballero
lcaballero / Content Carousel in JS
Last active December 21, 2015 09:39
Content Carousel in JS
@lcaballero
lcaballero / go-ab
Last active December 20, 2015 12:39
Go version of AB
package main
import (
"flag"
"io/ioutil"
"http"
"time"
"fmt"
"os"
)
package main
import (
"fmt"
_ "github.com/lib/pq"
_ "github.com/jmoiron/sqlx"
"database/sql"
"reflect"
)