Skip to content

Instantly share code, notes, and snippets.

View xseignard's full-sized avatar
🦄
Internet thuggin'

Xavier Seignard xseignard

🦄
Internet thuggin'
View GitHub Profile
@xseignard
xseignard / q2.js
Created December 18, 2012 04:24
Q2 from M101 final exam
// requires
var MongoClient = require('mongodb').MongoClient;
// mongodb uri
var uri = 'mongodb://localhost:27017/enron';
MongoClient.connect(uri, function(err, db) {
console.log('Connecting to the db...');
if (err) {
console.log('Error during connection. Aborting.');
@xseignard
xseignard / raf.js
Last active December 11, 2015 02:58
Request animation frame
define(function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
};
});
@xseignard
xseignard / google-analytics.js
Last active December 11, 2015 11:28
google analytics
define(function() {
var Analytics = {};
Analytics.init = function(id) {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', id]);
_gaq.push(['_trackPageview']);
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
};
@xseignard
xseignard / cfp.md
Last active December 14, 2015 01:18
Texte du cfp pour le breizhcamp

Javascript est partout! Et c'est tant mieux!

L'objectif de ce lab est de prendre en main Node.js, AngularJS ainsi que les bonnes pratiques et outils associés.

A la fin de celui-ci, vous serez capable de réaliser :

  • Une API REST (node.js et express) qui expose les données de votre base MongoDB
  • Une single page application moderne et modulable avec AngularJS et Bower
  • Du BDD avec Mocha et Karma (Backend ET Frontend)
  • De l'analyse qualité
@xseignard
xseignard / Taxiphone.pde
Last active December 15, 2015 19:19
Taxiphone
#include <Midi.h>
// instance of the Midi class
Midi midi(Serial2);
// number of phones
const int NUMBER_OF_PHONES = 2;
// input pins for dial
const int DIAL_IN[NUMBER_OF_PHONES] = {19,16};
// input pin for end of dial
@xseignard
xseignard / merge_lcov
Last active January 6, 2025 22:43
Merge lcov files
#!/bin/bash
while read FILENAME; do
LCOV_INPUT_FILES="$LCOV_INPUT_FILES -a \"$FILENAME\""
done < <( find $1 -name lcov.info )
eval lcov "${LCOV_INPUT_FILES}" -o $1/$2
@xseignard
xseignard / Gruntfile.js
Created April 23, 2013 18:04
grunt with mocha and istanbul : it feels like maven
module.exports = function(grunt) {
// set required env vars
(function() {
process.env.XUNIT_FILE = 'reports/xunit.xml';
process.env.ISTANBUL_REPORTERS = 'lcovonly';
}());
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@xseignard
xseignard / gist:5477705
Created April 28, 2013 17:47
log from node-gphoto2 tests
> [email protected] test /home/pi/projects/node-gphoto2
> node_modules/mocha/bin/mocha
gphoto2-port-info-list: Using ltdl to load io-drivers from '/usr/local/lib/libgphoto2_port/0.10.0'...
gphoto2-port-info-list: Called for filename '/usr/local/lib/libgphoto2_port/0.10.0/usb'.
gphoto2-port-info-list: Loaded '' ('^usb:') from '/usr/local/lib/libgphoto2_port/0.10.0/usb'.
gphoto2-port-info-list: Loaded 'Universal Serial Bus' ('usb:001,006') from '/usr/local/lib/libgphoto2_port/0.10.0/usb'.
gphoto2-port-info-list: Loaded 'Universal Serial Bus' ('usb:001,003') from '/usr/local/lib/libgphoto2_port/0.10.0/usb'.
{
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"theme": "Flatland Dark.sublime-theme"
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'install',
1 verbose cli 'grunt-contrib-sass',
1 verbose cli '--save-dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink /usr/bin/node
5 verbose read json /home/bigx/repos/breizhcamp-js/prez/package.json