Skip to content

Instantly share code, notes, and snippets.

View enrique-ramirez's full-sized avatar

Enrique Ramírez enrique-ramirez

View GitHub Profile
@enrique-ramirez
enrique-ramirez / day-1.js
Last active December 6, 2018 12:19
Advent of Code y(2018) solutions in JavaScript
/**
* --- Day 1: Chronal Calibration ---
* "We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and Detection Instrument Station tells you. She sounded pretty worried when she called you down here. "At 500-year intervals into the past, someone has been changing Santa's history!"
*
* "The good news is that the changes won't propagate to our time stream for another 25 days, and we have a device" - she attaches something to your wrist - "that will let you fix the changes with no such propagation delay. It's configured to send you 500 years further into the past every few days; that was the best we could do on such short notice."
*
* "The bad news is that we are detecting roughly fifty anomalies throughout time; the device will indicate fixed anomalies with stars. The other bad news is that we only have one device and you're the best person for the job! Good lu--" She taps a button on the device and you suddenly feel like you're falling. To save Christmas, you need
@enrique-ramirez
enrique-ramirez / day-1.js
Last active November 30, 2018 15:44
Advent of Code y(2017) solutions in JavaScript
/**
* --- Day 1: Inverse Captcha ---
* The night before Christmas, one of Santa's Elves calls you in a panic. "The printer's broken! We can't print the Naughty or Nice List!" By the time you make it to sub-basement 17, there are only a few minutes until midnight. "We have a big problem," she says; "there must be almost fifty bugs in this system, but nothing else can print The List. Stand in this square, quick! There's no time to explain; if you can convince them to pay you in stars, you'll be able to--" She pulls a lever and the world goes blurry.
*
* When your eyes can focus again, everything seems a lot more pixelated than before. She must have sent you inside the computer! You check the system clock: 25 milliseconds until midnight. With that much time, you should be able to collect all fifty stars by December 25th.
*
* Collect stars by solving puzzles. Two puzzles will be made available on each day millisecond in the advent calendar; the second puzzle is unlocked when you complete the first. Each
@enrique-ramirez
enrique-ramirez / look_ma_no_js.html
Last active January 2, 2016 21:59
This form will redirect the user to this url: http://google.com/search?q=SEARCHQUERY&tbm=TYPEOFSEARCH No JavaScript needed! :)
<form action="http://google.com/search" method="GET">
<fieldset>
<legend>Search using google</legend>
<label>
My Search Query
<input type="text" name="q" />
</label>
<label>
@enrique-ramirez
enrique-ramirez / shenanigans.js
Last active December 14, 2015 17:28
Inconsistencias tontas en JavaScript//jQuery usando attribute selectors con values que usan square brackets. Confusing. I know.
/**
* Regresa un objeto del input con atributo name="HOLA"
*/
$('input[name=HOLA]');
/**
* No regresa nada...
*/
$('input[name=HOLA[ULISES]]');