Skip to content

Instantly share code, notes, and snippets.

View marcoslhc's full-sized avatar
🏳️‍🌈

Marcos Hernández marcoslhc

🏳️‍🌈
View GitHub Profile
@marcoslhc
marcoslhc / gist:4688772
Last active December 12, 2015 01:08
File encode in Node.js
// from http://en.wikipedia.org/wiki/Data_URI_scheme
var fs = require('fs');
var base64_data = new Buffer(fs.readFileSync('sample.png')).toString('base64');
console.log('<img alt="sample" src="data:image/png;base64,' + base64_data + '">');
Process: TextMate [4324]
Path: /Users/USER/*/TextMate.app/Contents/MacOS/TextMate
Identifier: com.macromates.TextMate.preview
Version: 2.0.0-alpha.9359 (9359)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
User ID: 501
Date/Time: 2013-02-06 19:36:20.189 -0400
OS Version: Mac OS X 10.8.2 (12C60)
@marcoslhc
marcoslhc / extend_namespace.js
Last active December 12, 2015 12:28
Namespace - modules pattern
// see addy osmani http://addyosmani.com/blog/essential-js-namespacing/
// top-level namespace being assigned an object literal
var myApp = myApp || {};
// a convenience function for parsing string namespaces and
// automatically generating nested namespaces
function extend( ns, ns_string ) {
var parts = ns_string.split('.'),
parent = ns,
pl, i;
if (parts[0] == "myApp") {
@marcoslhc
marcoslhc / gist:5094879
Last active December 14, 2015 13:39
uuid Generator AMD style
define ["generate","getUUID"], (i) ->
rnd = ->
Math.random() * 16 | 0
random = rnd()
retval = 0
if i is 12
retval = 4
else
retval = if i is 16 then random & 3 | 8 else random
@marcoslhc
marcoslhc / dabblet.css
Created April 2, 2013 17:29
counter tag
/**
* counter tag
**/
#counter:before {
content:'';
position:absolute;
border: 3px solid green;
z-index:-1;
top:-5px; left: -5px; bottom: -5px; right: -5px;
border-radius:9999em;
@marcoslhc
marcoslhc / dabblet.css
Created April 2, 2013 19:34
counter tag
/**
* counter tag
**/
body {
background-image:url("http://lorempixel.com/1280/1024/abstract");
background-attachement:fixed;
background-size:cover;
}
.icon{
float:left;
/**
* red tag
**/
body {
background-image:url("http://lorempixel.com/1280/1024/abstract");
background-attachement:fixed;
background-size:cover;
}
.icon{
float:left;
@marcoslhc
marcoslhc / dabblet.css
Created April 3, 2013 01:20
Custom checkbox (By Lea Verou)
/**
* Custom checkbox (By Lea Verou)
*/
:root #custom {
position:absolute;
clip: rect(0,0,0,0)
}
:root #custom + label:before {
content:"\20e0";
@marcoslhc
marcoslhc / dabblet.css
Created April 17, 2013 19:45 — forked from LeaVerou/dabblet.css
iOS 6 style switch checkboxes
/**
* iOS 6 style switch checkboxes
* by Lea Verou http://lea.verou.me
*/
:root input[type="checkbox"] { /* :root here acting as a filter for older browsers */
position: absolute;
opacity: 0;
}
require 'less'
module Jekyll
class Less < Converter
safe true
priority :low
def matches(ext)
ext =~ /less/i
end