Skip to content

Instantly share code, notes, and snippets.

View jaimerodas's full-sized avatar

Jaime Rodas jaimerodas

View GitHub Profile
@jaimerodas
jaimerodas / numeroSimple.js
Created May 23, 2012 04:26
Simplificar numeros en JS
function numeroSimple(d) {
p = 100; // La base que usaremos
var a = [ "K", "M", "B", "T" ]; // Las abreviaturas
for (var i=a.length-1; i>=0; i--) {
var l = Math.pow(10, (i+1)*3);
if(size <= d) {
d = Math.round(d*p/l)/p;
d += a[i];
break;
}
@jaimerodas
jaimerodas / revisaAncho.js
Created August 5, 2012 02:40
Ligar eventos JS con declaraciones de body::after en CSS
function revisaAncho() {
var str;
if (window.getComputedStyle && window.document.querySelector) {
str = window.getComputedStyle(window.document.body, ':after').getPropertyValue('content');
} else {
str = "Regular";
}
return String(str).replace(/"/g, '');
}
@jaimerodas
jaimerodas / gist:3850677
Created October 8, 2012 04:11
Instalar ffmpeg en OSX
# Primero asegúrate que xcode y sus command line tools estén instaladas
# Tienes que descargar LAME, x264, faac y ffmpeg
# LAME - http://sourceforge.net/projects/lame/files/latest/download
# x264 - git clone git://git.videolan.org/x264.git
# faac - http://sourceforge.net/projects/faac/files/latest/download
# ffmpeg - git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
# Instalar LAME
cd lame/; ./configure && make && sudo make install; cd ..
@jaimerodas
jaimerodas / logger.php
Created October 9, 2012 21:38
Logger
<?
// Logger
class Log {
protected $path;
protected $format = 'Y-m-d H:i:s';
protected $enabled = TRUE;
public function __construct($p)
{
@jaimerodas
jaimerodas / Combinatoria.php
Last active October 11, 2015 14:38
Combinatoria
<?
// Algoritmo para sacar las combinaciones de n elementos
// Los elementos que hay que combinar
$elementos = array('a','b','c','d','e','f','g','h');
$elementos_invert = array_flip($elementos);
$cuantos = count($elementos);
$corridas = array();
$resultados = $elementos;
@jaimerodas
jaimerodas / debounce.js
Last active October 13, 2015 20:58
Debouncer en jQuery
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap) {
@jaimerodas
jaimerodas / black.html
Created January 11, 2013 03:04
Gif's de 1x1
<!-- Gif Negro -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
@jaimerodas
jaimerodas / Casa.geojson
Last active December 21, 2015 02:38
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jaimerodas
jaimerodas / gist:6470903
Created September 6, 2013 22:34
Para sacar nombres de fonts de un pdf
strings yourPDFfilepath.pdf | grep FontName
@jaimerodas
jaimerodas / index.html
Last active April 27, 2016 17:12
Tamaños y declaraciones para los `apple-touch-icons`
<!--
Íconos para iOS
-->
<!-- iPhone -->
<link rel="apple-touch-icon" href="57x57.png" />
<!-- iPad -->
<link rel="apple-touch-icon" sizes="72x72" href="72x72.png" />