Skip to content

Instantly share code, notes, and snippets.

using System;
namespace FortyOneShades
{
class Program
{
static int[] values = new int[]{
0x276AD9,
0x3E6FD9,
0x3A6FDE,
@endel
endel / authentication.js
Last active March 24, 2016 08:55
ng-admin authentication with hook https://github.com/doubleleft/hook
var app = angular.module('admin', ['ng-admin']),
hook = new Hook.Client({...});
var headerNav, pageWrapper, restangular;
if (hook.auth.currentUser && hook.auth.currentUser.role != 'admin') {
hook.auth.logout();
}
function hideMenu() {
@e-schultz
e-schultz / app.ts
Created April 6, 2016 12:37
NG2 Modal
import {Component} from 'angular2/core';
import Modal from './modal';
@Component({
selector: 'ngc-app',
template: `
<div class="p3">
<p class="p4">
<button class="btn btn-primary block col-6 mx-auto"
(click)="showModal()">
@jensgrubert
jensgrubert / README.md
Last active April 18, 2017 18:39 — forked from mbostock/.block
Histogram and Kernel density estimation

Kernel density estimation is a method of estimating the probability distribution of a random variable based on a random sample. In contrast to a histogram, kernel density estimation produces a smooth estimate. The smoothness can be tuned via the kernel’s bandwidth parameter. With the correct choice of bandwidth, important features of the distribution can be seen, while an incorrect choice results in undersmoothing or oversmoothing and obscured features.

This example shows a histogram and a kernel density estimation for times between eruptions of Old Faithful Geyser in Yellowstone National Park, taken from R’s faithful dataset. The data follow a bimodal distribution; short eruptions are followed by a wait time averaging about 55 minutes, and long eruptions by a wa

@mbostock
mbostock / .block
Last active May 25, 2017 07:54
Mexico
license: gpl-3.0
@plablo09
plablo09 / README.md
Last active July 5, 2017 09:30
Cartograma simple

Cartograma Simple

Aquí puedes ver la implementación más sencilla de un cartograma en d3.js. Lo único que hace el script es crear un mapa base y actualizar los polígonos de acuerdo al valor de una variable escalada

@mbostock
mbostock / .block
Last active October 31, 2017 22:24
Mexico
license: gpl-3.0
@aaizemberg
aaizemberg / colores.js
Last active December 1, 2017 14:26
categorical colors
// colores usados por Google en sus graficos, trends, etc.
//
function colores_google(n) {
var colores_g = ["#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00", "#b82e2e", "#316395", "#994499", "#22aa99", "#aaaa11", "#6633cc", "#e67300", "#8b0707", "#651067", "#329262", "#5574a6", "#3b3eac"];
return colores_g[n % colores_g.length];
}
//
//
var c10 = d3.scale.category10();
@emeeks
emeeks / index.html
Last active August 13, 2018 08:40
Brush Snapping
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: sans-serif;
color: #000;
text-rendering: optimizeLegibility;
}
@feyderm
feyderm / index.html
Last active June 4, 2020 09:22
D3 v4 single axis jitterplot pan and zoom
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<div id="block"></div>
<script>
// dimensions