Skip to content

Instantly share code, notes, and snippets.

View davelab's full-sized avatar

Davide Cariani davelab

  • Stuart
  • Barcelona
View GitHub Profile
@davelab
davelab / .editorconfig
Created March 22, 2016 10:20
editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@davelab
davelab / .eslintrc.js
Last active March 22, 2016 10:19 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@davelab
davelab / newPlugin.jquery.js
Last active March 22, 2016 10:10
jQuery Plugin Snippet
;(function($, window) {
'use-strict';
var pluginName = "",
defaults = {};
/**
* plugin constructor
* @param {object} parentElement the DOM of initialized plugin
* @param {object} options plugin config options
@davelab
davelab / 0_reuse_code.js
Created December 5, 2013 08:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davelab
davelab / mediaqueries.js
Last active December 27, 2015 09:09
media queries control for jquery
var winWidth = $(window).width();
if (winWidth <= '320') { //iPhone only Portrait orientation
}else if (winWidth >= '321' && winWidth <= '480') { //iPhone Landscape orientation
}else if (winWidth >= '481' && winWidth <= '768') { //iPad Portrait orientation
}else if (winWidth >= '769' && winWidth <= '1024') { //iPad Landscape orientation
@davelab
davelab / jQuery: setParentWidth
Last active October 12, 2015 13:07
jQuery: Set a parent width of an element
/*
* set a parent width to a given element
*/
$(element).each(function(){
$(this).css('width',$(this).parent().width());
});
@davelab
davelab / gist:3939973
Created October 23, 2012 16:41
HTML: blank html5 page
<!doctype html>
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie ie7 no-js" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie ie8 no-js" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie ie9 no-js" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]-->
<!-- the "no-js" class is for Modernizr. -->
<head>