Skip to content

Instantly share code, notes, and snippets.

View nltesown's full-sized avatar

NLTESOWN nltesown

  • Paris, France
View GitHub Profile
@nltesown
nltesown / readCheckboxes.js
Last active August 29, 2015 14:22
Takes a jQuery object of checkbox elements and returns info about the checked ones
// Takes a jQuery object of checkbox elements and returns:
// - An array of the IDs of the checked ones
// - (if asCollection is true) A collection of the checked ones where key=ID, value=true
// Dependency: jQuery, underscore/lodash
function readCheckboxes($cb, asCollection) {
return _($cb.filter(":checked"))
.map(function(item) {
return item.id;
})
.thru(function(item) {
@nltesown
nltesown / to-md-table.js
Last active November 13, 2015 06:50
JS collection to Markdown table
// Dependency: lodash (v3.10.1)
function toMDTable(collection) {
var colHeaders = _(collection).map(_.keys).flatten().union().value();
return [
colHeaders.join("|"),
"\n", (_.fill(Array(colHeaders.length), "---")).join("|"),
"\n", (_.map(collection, function(i) {
return _.map(colHeaders, function(h) {
return (typeof i[h] === "boolean" ? (i[h] ? "✓" : "✗") : i[h]);
}).join("|");
@nltesown
nltesown / README.md
Last active January 22, 2016 13:49
CFv3 Hors les murs
@nltesown
nltesown / data.json
Last active January 22, 2016 16:14
D3 force tree, change center node
[
{ "id": 0, "depth": 0, "children": [1, 2, 3, 4, 5] },
{ "id": 1, "depth": 1, "children": [10, 11, 12, 13, 14] },
{ "id": 2, "depth": 1, "children": [20, 21, 22, 23, 24] },
{ "id": 3, "depth": 1, "children": [30, 31, 32, 33, 34] },
{ "id": 4, "depth": 1, "children": [40, 41, 42, 43, 44] },
{ "id": 5, "depth": 1, "children": [50, 51, 52, 53, 54] },
{ "id": 10, "depth": 2 },
{ "id": 11, "depth": 2 },
{ "id": 12, "depth": 2 },
@nltesown
nltesown / index.html
Last active January 27, 2016 16:32
Logo Cinémathèque française SVG Web
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Logo Cinémathèque française SVG</title>
<style>
body {
background-color: #000;
}
@nltesown
nltesown / index.html
Created January 28, 2016 11:19
SVG Logo La Cinémathèque française
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Logo Cinémathèque française SVG</title>
<style>
body {
background-color: #222;
color: #eee;
@nltesown
nltesown / index.html
Last active February 3, 2016 14:36
Ruiz globe
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tryouts D3 Maps</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.2/normalize.min.css">
<link rel="stylesheet" href="main.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js"></script>
@nltesown
nltesown / d3.geo.zoom.js
Last active February 4, 2016 16:34 — forked from daf/index.html
d3 canvas graticule renderer
// Copyright (c) 2013, Jason Davies, http://www.jasondavies.com
// See LICENSE.txt for details.
(function() {
var radians = Math.PI / 180,
degrees = 180 / Math.PI;
// TODO make incremental rotate optional
d3.geo.zoom = function() {
@nltesown
nltesown / index.html
Created February 15, 2016 11:38
SVG Logo La Cinémathèque française - CSS version
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Logo Cinémathèque française SVG - CSS version</title>
<link rel="stylesheet" href="logocf.css">
<style>
body {
background-color: #222;
@nltesown
nltesown / SplitTable.js
Created June 10, 2016 14:08
SplitTable
/**
* SplitTable
* Enables the insertion/removal of a container below any given table row.
* The container is a full-width block table cell and is chainable with jQuery methods.
* Instantiation: t = new SplitTable($table, options)
* Use: t.splitAt(5).html("<p>Insert some content</p>") : inserts a container, a some content, below the 5th row
* t.unsplitAt(5): remove the container below the 5th row
* Dependencies: jQuery, lodash
* version 1.0.0 - 2016-06-10
*/