Skip to content

Instantly share code, notes, and snippets.

View gusaaaaa's full-sized avatar

Gusa gusaaaaa

  • Montevideo, Uruguay
View GitHub Profile
@gusaaaaa
gusaaaaa / bshtml5
Last active December 16, 2015 12:59
Bootstraps an empty HTML5 structure
# Outputs an empty HTML5 structure.
# Usage:
# emptyhtml5 [--with-script] [--with-style]
while [ $# -ne 0 ]
do
if [[ "$1" == "--with-script" ]]; then
script="
<script src=\"[youscript.js]\"></script>"
elif [[ "$1" == "--with-style" ]]; then
@gusaaaaa
gusaaaaa / promise-thenseq.js
Last active December 16, 2015 14:19
Generates a sequence of thens
// Requires https://github.com/tildeio/rsvp.js
// Once in a blue moon we need to concatenate several thens executing basically the same code.
// Example:
// f().then(function(message) {
// alert(message + " #1");
// return f();
// }).then(function(message) {
// alert(message + " #2");
// return f();
@gusaaaaa
gusaaaaa / gerbil-api-proposal.js
Created April 24, 2013 20:40
Gerbil new API proposal including support for promises (Promises/A+)
if(typeof module != "undefined")
var scenario = require("../lib/gerbil.js").scenario;
scenario("Gerbil - Assertions", {
"should be able to assert": function(g) {
g.assert(true, true);
g.assert(true); // g.assert(x, x) is equivalent to g.assert(x)
g.assert(1 == 1);
g.assert(true != false);
},
@gusaaaaa
gusaaaaa / gerbil-api-proposal.js
Created April 24, 2013 20:56
Gerbil new API proposal including support for promises (Promises/A+)
if(typeof module != "undefined")
var scenario = require("../lib/gerbil.js").scenario;
scenario("Gerbil - Assertions", {
"should be able to assert": function(g) {
g.assert(true, true);
g.assert(true); // g.assert(x, x) is equivalent to g.assert(x)
g.assert(1 == 1);
g.assert(true != false);
},
@gusaaaaa
gusaaaaa / es5tricks.js
Last active May 9, 2016 14:39
ECMAScript 5.1 tricks
// one-liner to build a sequence of numbers
// source: http://ariya.ofilabs.com/2013/01/es6-and-array-comprehension.html
Array.apply(0, Array(3)).map(function(x, y) { return y }); // [0, 1, 2]
// one-liner to filter elements
// source: http://ariya.ofilabs.com/2013/01/es6-and-array-comprehension.html
[1,4,2,3,-8].filter(function(i) { return i < 3 }); // [1, 2, -8]
@gusaaaaa
gusaaaaa / scrollto.js
Created May 31, 2013 20:57
Bookmarklet that vertically scrolls the page to the mouse pointer on click. Useful when you are reading a long text.
javascript:(function() { window.onclick = function(e) { window.scroll(0, e.pageY - 20) } })()
@gusaaaaa
gusaaaaa / vim_solve_conflicts.sh
Created February 19, 2014 15:06
Opens a tab per each file in conflict
git status | grep 'both modified' | awk '{print $4}' | vim -p `tr '\n' ' '`
@gusaaaaa
gusaaaaa / ejercicio3
Created August 16, 2014 19:00
Ejercicio para scrapatón
<html>
<head>
<title>Noticias</title>
</head>
<body>
<h1>Últimas noticias del día</h1>
<h2>Gaza: en medio de la tregua,
celebraron un casamiento en una
escuela de la ONU</h2>
<p>La pareja tenía previsto <a href=
@gusaaaaa
gusaaaaa / SassMeister-input-HTML.html
Created May 21, 2015 21:49
Generated by SassMeister.com.
<div class="sidebar"><h2>Sidebar</h2></div>
<div class="main">
<h2>Main</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
</div>
<div class="footer"><h2>Footer</h2></div>
<div class="header"><h2>He
@gusaaaaa
gusaaaaa / SassMeister-input-HTML.html
Created May 21, 2015 21:53
Generated by SassMeister.com.
<div class="spaceinvader">
<div class="pixel pixel1">&nbsp;</div>
<div class="pixel pixel2">&nbsp;</div>
<div class="pixel pixel3">&nbsp;</div>
<div class="pixel pixel4">&nbsp;</div>
<div class="pixel pixel5-11">&nbsp;</div>
<div class="pixel pixel12-13">&nbsp;</div>
<div class="pixel pixel14-16">&nbsp;</div>
<div class="pixel pixel17-18">&nbsp;</div>
<div class="pixel pixel19-29">&nbsp;</div>