Skip to content

Instantly share code, notes, and snippets.

View saleiva's full-sized avatar
🤓

Sergio Álvarez Leiva saleiva

🤓
View GitHub Profile
//goto: https://twitter.com/messages?since_id=0
// delete console.log
querySelectorAttempt._timerIDs = []
function querySelectorAttempt(selectors, callback, _attempts){
if (!Array.isArray(selectors)) selectors = selectors.toString().split(/\s*,\s*/)
console.log('querySelectorAttempt', selectors, _attempts)
if (_attempts == null) _attempts = 20;
var elements
selectors.forEach(function(selector){
@saleiva
saleiva / gist:4492202
Last active December 10, 2015 20:59 — forked from anonymous/gist:4266841
var t;
var posicion=0;
var mi_array=new Array();
//numero de diapositivas
//n es el numero de parámetros.
function presentacion(n){
for(var i=0; i<=n; i++){
mi_array[i]=i;
}
var posicion= 0;
var mi_array= new Array();
function presentacion(n){ //numero de diapositivas//
for(var i=0; i<=n; i++){
mi_array[i] = i;
console.log('numeroDiapositivas');
}
}
@saleiva
saleiva / examen.js
Created December 19, 2012 10:37 — forked from f3rn8nd0/examen.js
var array = new Array();
console.log("Bienvenido a tu propio proyector de diapositivas");
console.log("INSTRUCCIONES DE USO");
console.log("Escribe: carrusel(el número de imágenes)");
console.log("Una vez introducido el número, utiliza siguiente() para avanzar");
console.log("y anterior() para retroceder");
console.log("¡Feliz visionado!");
var posicion = 0;
//Crear simulador numérico de presentaciones
var a = new Array();
var posicion = 0;
var n = 20;
var t;
// Crea una lista de diapositivas
function lista(_n){
n = _n;
for (i=0; i<= _n; i++){
var a = new Array();
var n;
var posicion = 0;
// Crear una función que, al enviarle el número de diapositivas (ej:15), devuelva un array ordenado con ej(15) diapositivas.
function crearPresentacion(n){
for (var i=0; i<=n; i++){
a[i]=i;
}
return "creado";
@saleiva
saleiva / rasters.sql
Created September 14, 2012 13:28 — forked from andrewxhill/rasters.sql
Rasters to polygons for CartoDB
--Upload your new raster data
--In my case the data goes into a table, night_light
--In some cases, I find it useful to downsample the total number of variables in a band, or in some cases merge data from multiple bands into one.
--Here is an example how one such process would work
UPDATE night_light SET rast = ST_MapAlgebraExpr(rast,'8BUI','CASE WHEN [rast] = 0 THEN 10 WHEN [rast] = 255 THEN 11 ELSE floor([rast]/32)::int END');
--Create a new table, light_polygons
--Add a numeric column called, rast_value
@saleiva
saleiva / gist:3438086
Created August 23, 2012 16:06 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@saleiva
saleiva / carto.css
Created March 5, 2012 10:59
11870.com with CartoDB
#hoteles_madrid_11870 {
marker-fill:#0099FF;
marker-line-color:white;
marker-line-width:0;
marker-opacity:1;
marker-line-opacity:1;
marker-placement:point;
marker-type:ellipse;
marker-allow-overlap:true;
}
@saleiva
saleiva / CartoDB code
Created March 5, 2012 10:58
11870.com hotels density map in Madrid
SELECT count(cartodb_id) as ct, ST_Transform(ST_Buffer(ST_SnapToGrid(the_geom,0.002),0.001, ‘quad_segs=2 endcap=square’),3857) as the_geom_webmercator FROM hoteles_playground GROUP BY ST_SnapToGrid(the_geom,0.002)
#hoteles_playground{
polygon-fill:#FF6600;
polygon-opacity:.7;
}
#hoteles_playground[ct<=40]{
polygon-fill:#BD0026}
#hoteles_playground[ct<=20]{
polygon-fill:#F03B20}