Skip to content

Instantly share code, notes, and snippets.

@lexeek
lexeek / destructuring.js
Created May 24, 2016 03:16 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
var app = (function(w, d){
var myPrivateVariable = "My private content";
var __private = {
cache : function(){
this.link = d.querySelector('.link-item');
}
bind : function(){
this.link.addEventListener('click', this.handleClick, false);
},
<html>
<head>
<script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script language="javascript">
//
// client side image to base64 conversion for your CSS
// from revolunet team - contact@revolunet.com
// demo at : http://revolunet.com/static/drop.html
//
$(document).ready(function() {
@lexeek
lexeek / select2.js
Last active August 29, 2015 14:15 — forked from fonji/select2.js
/**
* Select2
*
* Renders Select2 - jQuery based replacement for select boxes
* https://gist.github.com/jbugwadia/9303389
*
* Usage: Works the same as Select editor, with the following extensions for Select2:
* schema.config: configuration object passed to Select2
* schema.multiple: sets 'multiple' property on the HTML <select>
*
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
D3 - Data Driven Documents
http://d3js.org/
low level library to display/manipulate data in HTML/CSS & SVG
API Ref: https://github.com/mbostock/d3/wiki/API-Reference
D3 Plus - D3 Extension plugin
https://github.com/alexandersimoes/d3plus
Fabric - HTML5 Canvas library
http://fabricjs.com/
@lexeek
lexeek / README.md
Last active August 29, 2015 14:10 — forked from joshcarr/README.md

d3.js example showing a scatterplot with 500-50,000 random points and its associated density heat chart

@lexeek
lexeek / Jcrop.js
Last active August 29, 2015 14:08
// Resources needed:
// Jcrop - http://deepliquid.com/content/Jcrop.html
// loadImage - https://github.com/blueimp/JavaScript-Load-Image
initJcrop: function (isEdit) {
Page.elems.$photoWrapper.find('img').Jcrop({
onChange: function (coo) {
Page.vars.photoParams = coo;
},
onSelect: function (coo) {
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
jQuery.placeholder = function() {
$('[placeholder]').focus(function() {
var input = $(this);
if (input.hasClass('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() === '') {