Skip to content

Instantly share code, notes, and snippets.

View lionelB's full-sized avatar
🪂
Working from home

Lionel lionelB

🪂
Working from home
View GitHub Profile
@lionelB
lionelB / colorz.js
Last active December 17, 2015 19:39
A simple cli helper to ease the use of colors in the terminal
var colorz = {
black : '\u001b[30m',
red : '\u001b[31m',
green : '\u001b[32m',
yellow : '\u001b[33m',
blue : '\u001b[34m',
magenta : '\u001b[35m',
cyan : '\u001b[36m',
white : '\u001b[37m'
}
@lionelB
lionelB / gist:5877042
Last active December 19, 2015 01:38 — forked from bloodyowl/gist:4340751

Smallest HTML5 shim ever

130 bytes, that's what it takes.

Script

"header footer section aside nav article figure figcaption hgroup time main video".replace(/\w+/g,function(a){document.createElement(a)})
@lionelB
lionelB / async-loader.js
Last active December 19, 2015 09:59
Async loading for additional script
/*! JS async loader http://www.phpied.com/async-javascript-callbacks */
/*! http://www.html5rocks.com/en/tutorials/speed/script-loading/ */
(function(win, doc, s, undefined){
var src
, head = document.getElementsByTagName('head')[0]
, fs = document.getElementsByTagName(s)[0];
function loader(url, callback) {
var tag = document.createElement(s);
@lionelB
lionelB / index.html
Last active December 29, 2015 04:08
An attempt to do a Numeric Stepper the Angular Way http://plnkr.co/edit/R4FYQKCGyB1GYl2hL4LO
<!doctype html>
<html ng-app="ui">
<head>
<meta charset="UTF-8">
<title>Angular numeric Stepper</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, height=device-height, maximum-scale=1" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap-theme.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.css" />
@lionelB
lionelB / README.md
Last active December 29, 2015 12:48 — forked from t8g/index.html
numeric stepper attribute directive.

Numeric stepper

an angular directive for building a numeric stepper

##features

  • Define minimun, maximun values and a stepSize,
  • choose cycling through value when reach minimum or maximun
  • integrate well whitin a form (update valid / invalid state)
  • update value with keyboard arrow
@lionelB
lionelB / server.js
Created November 27, 2013 11:32
simple static + proxyfy call to API server built with connect
/* jshint node:true, strict:false */
var connect = require('connect')
, proxy = require('proxy-middleware')
, url = require('url');
var app = connect()
.use(connect.urlencoded())
.use(connect.logger('dev'))
.use(connect.favicon())
.use('/api', proxy(url.parse('https://server.com/api')))
@lionelB
lionelB / SassMeister-input.scss
Created November 28, 2013 09:34
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@function stricteq($a, $b) {
@if ($a == $b) {
@if (unit($a) == unit($b)) {
@return true;
}
@lionelB
lionelB / logo.svg
Last active December 30, 2015 03:29
Chti js logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lionelB
lionelB / proxy.js
Created January 9, 2014 08:03
connect server with node-http-proxy
var httpProxy = require('http-proxy'),
connect = require('connect'),
endpoint = {
host: 'server.com', // or IP address
port: 443,
prefix: '/api'
},
staticDir = 'public';
@lionelB
lionelB / objectFlattener.js
Last active August 29, 2015 13:55
flatten object hierarchy. Rely on (underscore|lodash).js - Object's keys with the same name will be overwritten
_.reduce(o, function red(memo, val, key){
if(typeof val === 'object'){
_.reduce(val, red, memo)
} else {
memo[key] = val;
}
return memo;
}, Object.create(null));