Skip to content

Instantly share code, notes, and snippets.

@anotherjavadude
anotherjavadude / index.html
Created June 16, 2012 10:20
Most simple d3.js stack bar chart from matrix
<!DOCTYPE html>
<html>
<head>
<title>Simple Stack</title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
svg {
border: solid 1px #ccc;
font: 10px sans-serif;
shape-rendering: crispEdges;
@jseabold
jseabold / ipcluster_launcher.py
Created March 29, 2013 20:17
Start an IPython cluster with subprocess
"""
Creates a task interface.
Change to
view = rc[:]
for a direct interface.
"""
from IPython.parallel import Client
@rogeruiz
rogeruiz / source.js
Created May 30, 2013 21:20
Central Limit Theorem Visualized in D3 by Victor Powell
function lvl(d){
// given a triangle element index, calculate it's y depth within
// the larger peramind of triangles
d = d + 1
var i = 0, n = 1
while(i + n < d){
i += n
n++
}
@mattidupre
mattidupre / plugin.jquery.cjs.js
Created April 14, 2014 18:59
Wrapper for converting jQuery plugins to CommonJS
(function (factory) {
if (typeof exports === 'object') {
// CommonJS
factory(require('./jquery'));
} else {
// Standard globals
factory(jQuery);
}
}(function ($) { // or (jQuery)
// Plugin code goes here.
@tariqmislam
tariqmislam / instructions and how-to
Created March 22, 2012 15:58
Setting Up Hadoop 0.20.2 on Windows 7 With Cygwin
=================================================================
SETTING UP SSHD AS A SERVICE FOR RUNNING HADOOP DAEMONS ON WINDOWS 7
=================================================================
Steps:
1. Download 'setup.exe' from Cygwin website
2. Right-click on 'setup.exe'
3. Leave settings as they are, click through until you come to the plugin selection window
3.1 - Make sure that the installation directory is 'C:\cygwin'
@jmarceli
jmarceli / README.md
Last active October 31, 2019 09:46
React errors explained

1

You will get one of these:

Uncaught (in promise) TypeError: Cannot read property 'toUpperCase' of undefined(…)

ReactCompositeComponent.js:870 Uncaught TypeError: Cannot read property 'displayName' of undefined

if you try to:

@lentil
lentil / gist:810399
Created February 3, 2011 22:55
PEP8 pre-commit hook in Python
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
@ushu
ushu / S3 buckets copy.md
Created October 29, 2013 16:12
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@stephensauceda
stephensauceda / gulpfile.babel.js
Created June 11, 2015 23:45
ES6 Gulpfile Example
/*
* Steps
* 1. Rename your gulpfile.js to gulpfile.babel.js
* 2. Add babel to your package.json (npm install -D babel)
* 3. Start writing ES6 in your gulpfile!
*/
import gulp from 'gulp'; // ES6 imports!
import sass from 'gulp-sass';