Skip to content

Instantly share code, notes, and snippets.

Dan Racanelli elrasguno

Block or report user

Report or block elrasguno

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elrasguno
elrasguno / 538.sh
Created Oct 17, 2016 — forked from mmaelzer/538.sh
Bash script to fetch latest polls-only forecast from fivethirtyeight.com. Defaults to US but allows an optional state argument.
View 538.sh
#!bin/bash
# Fetches data from http://projects.fivethirtyeight.com/2016-election-forecast/summary.json,
# parses the results using python, and prints the polls-only forecast results in the format:
# "{STATE} D {PROBABILITY} R {PROBABILITY}"
#
# The script takes an optional argument that specifies an individual two letter abbreviation (case insensitive)
# of a U.S. state. By default, the state is US which returns the national results.
#
# Examples:
@elrasguno
elrasguno / aggregate_json_parser.js
Created Dec 1, 2014
Aggregate multiple JSON strings into one to save on JSON.parse CPU consumption.
View aggregate_json_parser.js
/**
* Aggregate multiple JSON strings into one to save on CPU.
*
* @param {Array} jsonStringsArray An array of valid JSON strings to be parsed together.
* @returns {Array} An array of JavaScript Objects, or an empty array if any members of the input array are invalid JSON.
*/
function aggregateParseJSON(jsonStringsArray)
{
var tmpArray = '[' + jsonStringsArray.join(',') + ']',
parsed = [];
@elrasguno
elrasguno / how_unit_testing_saves_lives_or_your_sanity.md
Last active Aug 29, 2015
How Unit Testing Saves Lives, or Your Sanity
View how_unit_testing_saves_lives_or_your_sanity.md

(See original post, and some photography here)

For the longest time, I didn't really understand what it meant to unit test code. I remember thinking something along the lines of "wait, so I write a function that adds one to a number. then I write a test to prove that it added one to a number?" It just seemed to me, as I'm sure it does to many people, like extra work, and unit testing wasn't worth the overhead involved it testing all of my code. I mean, I tested it all when I was developing it, right?

Those were the good old days of back end development, when all you needed to do to test your app was hit your web interface, validate input for malicious data, and display error messages to users when they missed a spot filling in a form. Maybe you used an IDE for remote breakpoint debugging, but old school error logging usually did the trick just fine. Load page, fill form, validate error conditions, rinse, repeat.

In a mobile develop

@elrasguno
elrasguno / vimrc
Created Dec 22, 2011
My vimrc file
View vimrc
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 1999 Jul 25
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
set noswapfile
@elrasguno
elrasguno / jquery.animateDiv.js
Created Apr 13, 2011
Convert a container that normally holds a number into an "odometer" style collection of animated divs.
View jquery.animateDiv.js
(function($) {
$.extend($.fn, {
animateDiv : function(rValue, rOptions, rSpriteOrImg) {
var selff = this,
debug = false,
vFrames = rOptions['pFrames'] || 10,
vFrameSize = rOptions['pFrameSize'],
vOrientation = (rOptions['pOrientation'] > -1 ? rOptions['pOrientation'] : 1),
vClassName = rOptions['pClassName'] || 'numbers_test',
vSpriteOrImg = rSpriteOrImg || 'sprite';
@elrasguno
elrasguno / Ringz.js
Created Apr 12, 2011
Possible approach to platform specific handling for ringz app.
View Ringz.js
console && console.log('this is ringz!');
var RingzApp = function(rPlatform) {
var vPlatform = rPlatform || 'web',
vClickerConfig,
vRingzEventHandler;
/***
* Platform specific Clicker/Event config
**/
@elrasguno
elrasguno / index.html
Created Apr 5, 2011
InterviewHello.js
View index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="./interview_hello.js"></script>
</head>
<body>
</body>
</html>
You can’t perform that action at this time.