Skip to content

Instantly share code, notes, and snippets.

View jeremenichelli's full-sized avatar

Jeremias Menichelli jeremenichelli

View GitHub Profile
@jeremenichelli
jeremenichelli / getElementsByClassName-polyfill.js
Last active August 29, 2015 14:05
getElementsByClassName polyfill
(function(document){
if(!document.getElementsByClassName){
document.getElementsByClassName = function(str){
return document.querySelectorAll('.' + str);
};
}
})(document);
@jeremenichelli
jeremenichelli / clearfix.mixin.less
Created December 12, 2014 23:05
Clearfix LESS mixin
/* --- CLEARFIX --- */
.clearfix() {
*zoom: 1;
&:before,
&:after {
display: table;
line-height: 0;
content: "";
}
@jeremenichelli
jeremenichelli / _getHead.js
Created February 13, 2015 19:42
Use IIFE to retrieve head tag when executed
document.head = (function(d) {
return d.head || d.getElementsByTagName('head')[0];
})(document);
@jeremenichelli
jeremenichelli / shuffle.js
Last active August 29, 2015 14:17
Shuffle arrays
shuffle = function (arr) {
var newArr = [],
origArr,
len;
if (!!arr && ) {
origArr = arr.slice();
len = arr.length;
while (len) {
@jeremenichelli
jeremenichelli / _getFromPath.js
Last active August 29, 2015 14:19
Given a path, get property of an object
function getFromPath(obj, path, defaultValue) {
var props = path.split('.'),
newObj = obj;
for (var i = 0, len = props.length; i < len; i++) {
if (newObj[props[i]] !== null && newObj[props[i]] !== undefined) {
newObj = newObj[props[i]];
} else {
return defaultValue || null;
}
@jeremenichelli
jeremenichelli / box-sizing-samples.html
Last active August 29, 2015 14:21
box-sizing samples
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>box-sizing samples</title>
<style>
body {
text-align: center;
}
@jeremenichelli
jeremenichelli / .eslintrc
Last active January 6, 2016 14:42
lint sample files
{
// http://eslint.org/docs/rules/
"env": {
"es6": true,
"browser": true,
"jasmine": true
},
"globals": {},
@jeremenichelli
jeremenichelli / bash-reference.md
Last active January 18, 2016 12:17
Bash reference

rm

Removes a file

rm app.js

cp

(function() {
'use strict';
function helper() {
  /* inlined function from module */
  }
var action = function() {
var value = helper();
return value;
var webpack = require('webpack');
module.exports = {
// your config
plugins: [
new webpack.optimize.ModuleConcatenationPlugin()
]
};