Skip to content

Instantly share code, notes, and snippets.

View alvaropinot's full-sized avatar
🤘
Metal this

Alvaro Pinot @alvaropinot alvaropinot

🤘
Metal this
View GitHub Profile
@alvaropinot
alvaropinot / Paper-css-shadows.markdown
Created February 13, 2014 17:21
A Pen by NeatNait.

Paper css shadows

Testing some lighting and shadows, trying to obtain a kind of realistic paper.

A Pen by NeatNait on CodePen.

License.

Floating text shadow animation

Subtle animation of the shadow beneath the text, simulating the text getting near the page.

A Pen by NeatNait on CodePen.

License.

@alvaropinot
alvaropinot / args.js
Last active August 29, 2015 14:15
simple url arguments reader
//remove the starting '?' and split options
location.search.slice(1).split("&").forEach(function(opt) {
opt = opt.split('=');
console.log(opt); // ['arg1','val1'] ['arg2','val2']
});
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
//from https://github.com/achohq/acho/blob/0a57c8450e781ca69c248103f48a24818dca695b/lib/Constants.coffee
'use strict'
figure =
false:
info : 'ℹ'
success : '✔'
warning : '⚠'
error : '✖'
@alvaropinot
alvaropinot / defaults-overrides.md
Created May 9, 2016 12:27 — forked from ericelliott/defaults-overrides.md
ES6 defaults / overrides pattern

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({
    bar = 'no',
    baz = 'works!'
  } = {}) {
@alvaropinot
alvaropinot / get.js
Last active June 21, 2016 09:59
get.js
function _get(property, defaultValue) {
var path = property.split(/[\.\["'\]]+/);
return function(obj) {
return typeof obj === 'object' ? path.reduce(function (acc, key) {
var value = acc && acc[key];
// should allow null and falsy values.
return (value || (value !== undefined)) ?
value :
defaultValue;
}, obj) :