Skip to content

Instantly share code, notes, and snippets.

View janogarcia's full-sized avatar

Jano Garcia janogarcia

View GitHub Profile
LICENCIA PÚBLICA de NO SEAS UN CAPULLO
Version 1, Diciembre 2009
Copyright (C) 2009 Philip Sturgeon <email@philsturgeon.co.uk>
Se autoriza la reproducción y distribución de las copias del presente documento de licencia, y se permite así mismo su modificación siempre y cuando se cambie el nombre de la licencia.
LICENCIA PÚBLICA de NO SEAS UN CAPULLO
TÉRMINOS Y CONDICIONES PARA LA COPIA, DISTRIBUCIÓN Y MODIFICACIÓN
@janogarcia
janogarcia / space.less
Last active November 12, 2018 03:12
Less CSS spacing classes generator
// Live demo: paste this gist's code on http://less2css.org/
@start: left;
@end: right;
@base-space-0: 0;
@base-space-1: 1rem;
@base-space-2: 2rem;
@base-space-3: 3rem;
@janogarcia
janogarcia / cs_vs_es6.md
Last active July 13, 2018 07:17
CoffeeScript Vs ES6 reading list
@janogarcia
janogarcia / haml_partials.haml
Created May 3, 2012 11:28
HAML Partials wihout Rails (useful for LiveReload)
/ A simplistic way of loading and rendering HAML partials (header.haml, footer.haml, nav.haml... you name it) without Rails
/ Useful when using tools like LiveReload http://livereload.com/
/ but don't want to configure a web server just to use PHP include/require constructs (discussion http://help.livereload.com/discussions/questions/22-haml-partials)
/ It could be improved/simplified using a helper http://stackoverflow.com/questions/5436769/partial-haml-templating-in-ruby-without-rails/5436973#5436973
/ Check out the Jade version https://gist.github.com/2593727
%html
%body
%header
= Haml::Engine.new(File.read('/path/to/your/partial.haml')).render
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<!-- utf-8 works for most cases -->
<meta charset="utf-8">
<!-- Forcing initial-scale shouldn't be necessary -->
<meta name="viewport" content="width=device-width">
@janogarcia
janogarcia / wp_security.md
Last active November 30, 2016 11:24
WordPress - Basic Security
@janogarcia
janogarcia / jade_include.jade
Created May 4, 2012 10:00
Jade Include (useful for LiveReload)
// Jade (http://jade-lang.com) version of this HAML snippet https://gist.github.com/2585095
html
body
header
include partial
footer
@janogarcia
janogarcia / http_build_url.php
Last active December 14, 2015 18:09
CodeIgniter helper: http_build_url() PHP implementation
<?php
/**
* Takes an associative array in the layout of parse_url, and constructs a URL from it
*
* see http://www.php.net/manual/en/function.http-build-url.php#96335
*
* @param mixed (Part(s) of) an URL in form of a string or associative array like parse_url() returns
* @param mixed Same as the first argument
* @param int A bitmask of binary or'ed HTTP_URL constants (Optional)HTTP_URL_REPLACE is the default
@janogarcia
janogarcia / php_bug_unset_object_property_by_reference.php
Last active December 14, 2015 01:29
PHP Bug: An object is automatically created if an unset object with a property is passed by reference. Inconsistent warnings depending on the variable type.
<?php
// Possible PHP Bug:
// An object is automatically created if an unset object with a property is passed by reference
// Inconsistent Warnings depending on the variable type
// Live test http://codepad.viper-7.com/ueZkz4
// Possibly related PHP bug https://bugs.php.net/bug.php?id=52237
<?php
class MY_Model extends CI_Model {
// Form validation rules
protected $rules = array();
// Sets form validation rules
protected function set_rules($field_names)
{