Skip to content

Instantly share code, notes, and snippets.

View magalhini's full-sized avatar

Ricardo Magalhães magalhini

View GitHub Profile
@magalhini
magalhini / A-Pen-by-Ricardo-Magalhães.markdown
Created February 10, 2014 13:15
A Pen by Ricardo Magalhães.
var browser = (function () {
var ua = navigator.userAgent.toLowerCase(),
platform = navigator.platform.toLowerCase(),
UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
mode = UA[1] === 'ie' && document.documentMode,
name = (UA[1] === 'version') ? UA[3] : UA[1],
version = mode || parseFloat((UA[1] === 'opera' && UA[4]) ? UA[4] : UA[2]),
browser;
return {
@magalhini
magalhini / Mars Challenge
Last active August 29, 2015 13:58
Mars Challenge
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Mars Challenge" />
<meta charset="utf-8">
<title>Mars Challenge</title>
</head>
<body>
<h2>Mars Challenge</h2>
<pre class="neutral">
/**
* __series
* Given an array of functions, it will call every function,
* once at a time, sequentially.
* Every function will have a trigger function as its last argument,
* that should be called when the function is done.
* If arguments are given to this trigger function, those will be passed
* to the next function.
*
* @example
@magalhini
magalhini / screenshot.js
Last active August 29, 2015 14:03
node.js Image Comparison with GIF output
/* Takes two images and compares them.
* If they're different, a GIF with the differences will be created.
*
* @requires ImageMagick to be installed to generate the GIF :(
* Install it via Homebrew: brew install imagemagick
*
* @usage: node screenshot.js file1.jpg file2.jpg
*/
var pngparse = require('pngparse');
var exec = require('child_process').exec;
@magalhini
magalhini / development.md
Last active August 29, 2015 14:09
Web Development: Articles & Resources
@magalhini
magalhini / index.html
Last active August 29, 2015 14:12
Menu Selector Animation -- trying not to break...// source http://jsbin.com/lokaqo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Menu Selector Animation -- trying not to break..." />
<link href='http://fonts.googleapis.com/css?family=Raleway:400,500,800' rel='stylesheet' type='text/css'>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
* {
-webkit-box-sizing: border-box;
(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,
#!/bin/bash
# This script intends to remove all unused images from the project.
# Use with caution and don't forget to back-up before using.
SRC=./source/images
# Create a `.tmp` folder
mkdir -p .tmp