Skip to content

Instantly share code, notes, and snippets.

@Loac-fr
Loac-fr / timing.js
Created June 28, 2015 13:51
Measuring task time in Js
console.time("foo");
// do stufff
console.timeEnd("foo");
// http://codepen.io/KK4OXJ/pen/eNyRYr
@Loac-fr
Loac-fr / youmightnotneedjquery_examples.js
Created April 20, 2015 09:32
Lea Verou's add class without jQuery
// http://youmightnotneedjquery.com/
// Returns first element that matches CSS selector {expr}.
// Querying can optionally be restricted to {container}’s descendants
function $(expr, container) {
return typeof expr === "string"? (container || document).querySelector(expr) : expr || null;
}
// Returns all elements that match CSS selector {expr} as an array.
// Querying can optionally be restricted to {container}’s descendants
function $$(expr, container) {
@Loac-fr
Loac-fr / hamburger-anim.scss
Last active August 29, 2015 14:16
Hamburger menu markup
<div id="toggle" class="">
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
</div>
<!-- just toggle the "on" class with js :) -->