Skip to content

Instantly share code, notes, and snippets.

@slojo404
slojo404 / linkedin-api-invite
Created May 29, 2012 — forked from hjr3/linkedin-api-invite
Simple example of using the LinkedIn JavaScript SDK to send an invite
View linkedin-api-invite
<!DOCTYPE html>
<html>
<head>
<script>
function invite() {
var url = '/people/~/mailbox',
body = {
recipients: {
values: [{
person: {
@slojo404
slojo404 / learning_gabor_filters.py
Created May 26, 2012 — forked from amueller/learning_gabor_filters.py
Learning Gabor filters with scikit-learn and ICA or k-means
View learning_gabor_filters.py
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_mldata
from sklearn.decomposition import FastICA, PCA
from sklearn.cluster import KMeans
# fetch natural image patches
image_patches = fetch_mldata("natural scenes data")
X = image_patches.data
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Projection Demo</title>
<script type='text/javascript' src='http://mbostock.github.com/d3/d3.js'></script>
<script type='text/javascript' src='http://mbostock.github.com/d3/d3.geo.js'></script>
<style type='text/css'>
body {
margin:5px auto;
}
@slojo404
slojo404 / README.md
Created Apr 19, 2012 — forked from syntagmatic/README.md
Canvas Parallel Coordinates - Shuffled Rendering
View README.md

An example of an SVG interaction layer over a canvas rendering layer. Data from the USDA Nutrition Database.

This example has a few design differences from most parallel coordinates:

  • requestAnimationFrame for gradual rendering
  • shuffled rendering order (Fisher-Yates)
  • bezier curves with canvas
  • autoscaling opacity
  • tick toggles
  • dark/light themes
@slojo404
slojo404 / index.html
Created Apr 19, 2012 — forked from stepheneb/index.html
D3 Example: zoom, pan, and axis rescale
View index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>One Graph</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="simple-graph.js"></script>
<style type="text/css">
body { font: 13px sans-serif; }
rect { fill: #fff; }
@slojo404
slojo404 / index.html
Created Apr 18, 2012 — forked from bunkat/index.html
Swimlane Chart using d3.js
View index.html
<html>
<head>
<title>Swimlane using d3.js</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="randomData.js"></script>
<style>
.chart {
shape-rendering: crispEdges;
}
@slojo404
slojo404 / index.html
Created Apr 18, 2012 — forked from bunkat/index.html
Timeline using d3.js
View index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Chronological Diagram of Asia</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style type="text/css">
.chart {
shape-rendering: crispEdges;
}
@slojo404
slojo404 / README.md
Created Apr 11, 2012 — forked from mbostock/.block
Line Transition
View README.md

D3’s default path interpolation is the same as its string interpolation: it finds numbers embedded in strings, and interpolates those numbers. So, the default behavior when interpolating two paths is like this:

M x0, y0 L x1, y1 L x2, y2 L x3, y3 
   ↓   ↓    ↓   ↓    ↓   ↓    ↓   ↓
M x0, y1 L x1, y2 L x2, y3 L x3, y4 

For example, the first point ⟨x0,y0⟩ is interpolated to ⟨x0,y1⟩. Since x0 is the same, all you see are the y-values changing (see example)—you don't see the path slide to the left as intended.

What you want to happen here is something like this:

@slojo404
slojo404 / logstash RPM spec
Created Mar 28, 2012 — forked from paul-at/logstash RPM spec
logstash monolithic init script and spec file for CentOS / RedHat
View logstash RPM spec
Name: logstash
Version: 1.1.0
Release: 1%{?dist}
Summary: logstash is a tool for managing events and logs
Group: System/Logging
License: ASL 2.0
URL: http://logstash.net/
Source0: http://semicomplete.com/files/logstash/logstash-%{version}-monolithic.jar
Source1: logstash