Skip to content

Instantly share code, notes, and snippets.

View louischatriot's full-sized avatar

Louis Chatriot louischatriot

View GitHub Profile
@louischatriot
louischatriot / gist:2601571
Created May 5, 2012 11:02
d3 introduction: animated graph in 11 LOC
<!DOCTYPE html>
<html manifest="cache.manifest">
<head> <title>d3 example</title> </head>
<body>
<div id='d3TutoGraphContainer'></div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script>
@louischatriot
louischatriot / chart.js
Created May 5, 2012 11:21
d3 introduction code - js part
// Suppose there is currently one div with id "d3TutoGraphContainer" in the DOM
// We append a 600x300 empty SVG container in the div
var chart = d3.select("#d3TutoGraphContainer").append("svg").attr("width", "600").attr("height", "300");
// Create the bar chart which consists of ten SVG rectangles, one for each piece of data
var rects = chart.selectAll('rect').data([1 ,4, 5, 6, 24, 8, 12, 1, 1, 20])
.enter().append('rect')
.attr("stroke", "none").attr("fill", "rgb(7, 130, 180)")
.attr("x", 0)
.attr("y", function(d, i) { return 25 * i; } )
@louischatriot
louischatriot / nodejs-app.conf
Created August 18, 2012 07:47
Upstart script to launch a nodejs application as a service
description "Upstart script to run a nodejs app as a service"
author "Louis Chatriot"
env NODE_BIN=/usr/local/bin/node
env APP_DIR=/path/to/app/dir
env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app
env LOG_FILE=/path/to/logfile.log
env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges
env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...)
# I typically use the environment variable NODE_ENV (see below)
@louischatriot
louischatriot / gist:5698805
Last active June 27, 2018 09:14
Trying to use the VLC plugin work in windowless mode on linux. This HTML file is the windowless example from the Git repo for the plugin (git://git.videolan.org/npapi-vlc.git). I just added one line (L238) that tries to draw a red square on top of the player, but it is behind ...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<title>VLC Plugin test page</TITLE>
<style>
.inputTrackerInput {
height:20;
width:30;
font-family : Arial, Helvetica, sans-serif;
font-size : 12px;
}
@louischatriot
louischatriot / bugreport.js
Last active February 13, 2022 12:03
Example of a good bug report for NeDB
// Put all your require statements at the top. Your gist should contain a package.json which lets me download all
// the dependencies needed to test your bug report with a simple 'npm install'
var async = require('async')
, someOtherModule = require('xxx')
, fs = require('fs');
// Then require nedb and chai. You need to use chai for your assertions
var Nedb = require('nedb')
, chai = require('chai')
, assert = chai.assert; // Chai supports assert and should style of assertion