Skip to content

Instantly share code, notes, and snippets.

View t8g's full-sized avatar

Thomas Moyse t8g

  • ByteClub
  • Nantes
View GitHub Profile
@t8g
t8g / gist:1058244
Created July 1, 2011 10:19
json pretty print
// NOTE : ça utilise le $.each de jquery, mais on peut utiliser n'importe quoi d'autre
// Inspiré de la lib JSON du ZEND Framework
// st : chaine json
var tokens = st.split(/([\{\}\]\[,])/g);
var ind = 0;
var result = '';
$.each(tokens, function(i, token) {
if (token == '') return;
var prefix = new Array(ind+1).join('\t');
@t8g
t8g / gist:1131377
Created August 8, 2011 07:59
Petit tests de hook.io
/* FILE 1 */
/* Le serveur qui écoute (à lancer en premier) */
var Hook = require('hook.io').Hook,
util = require('util');
var instance = new Hook({ name: 'server', debug: true});
instance.on('hook::listening', function(data){
//console.log('LISTENING');
//console.log(instance.defaults['hook-host']);
@t8g
t8g / gist:1141594
Created August 12, 2011 06:51
How to detect server missing in dnode
// CLIENT
var dnode = require('dnode');
var EventEmitter = require('events').EventEmitter;
var dnode = new dnode();
dnode.addListener('error', function(err){
console.log('ERREUR ' + err);
});
@t8g
t8g / Fetch.sublime-settings
Created January 3, 2012 14:36
Nettuts Fetch Sublimetext2
{
"files":
{
"cycle": "http://malsup.github.com/jquery.cycle.all.js",
"infinite_scroll": "https://github.com/paulirish/infinite-scroll/blob/master/jquery.infinitescroll.min.js",
"jquery": "http://code.jquery.com/jquery.min.js",
"localscroll": "http://flesler-plugins.googlecode.com/files/jquery.localscroll-1.2.7-min.js",
"raphael": "http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js",
"reset": "http://meyerweb.com/eric/tools/css/reset/reset.css",
"scrollorama": "https://github.com/johnpolacek/scrollorama/blob/master/js/jquery.scrollorama.js",
@t8g
t8g / include.js
Created January 23, 2012 07:50 — forked from indexzero/include.js
Find the source of your `sys` deprecation warnings in [email protected]
//
// Place this at the beginning of your node.js program before
// **any and all** require statements.
//
var util = require('util');
var _warning = util._deprecationWarning;
util._deprecationWarning = function () {
console.trace();
_warning.apply(util, arguments);
@t8g
t8g / index.html
Last active December 29, 2015 04:38 — forked from lionelB/index.html
<!doctype html>
<html ng-app="ui">
<head>
<meta charset="UTF-8">
<title>Angular numeric Stepper</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, height=device-height, maximum-scale=1" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap-theme.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.css" />
@t8g
t8g / index.html
Last active December 29, 2015 18:08
A very small (and useless) todo app
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body ng-app ng-init="users = []">
<ul>
<li ng-repeat="item in users">{{ item }} <a href="" ng-click="users.splice($index, 1)">x</a></li>
</ul>
<input ng-model="item" placeholder="todo"><button ng-click="users.push(item);item='';">Add</button>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script>
@t8g
t8g / package.json
Created December 17, 2013 08:29
Formation Angular : fake.js
{
"name": "fake",
"version": "0.0.0",
"license": "BSD-2-Clause",
"dependencies": {
"lodash": "~2.4.1",
"express": "~3.4.7",
"node-uuid": "~1.4.1"
}
}
@t8g
t8g / pl.js
Last active January 1, 2016 19:59
Print to pdf with header (lmtm)
#!/usr/bin/env node
// INSTALLATION :
// install phantomjs && node
// > (sudo) npm install -g marked
// > (sudo) npm install -g tmp
// Copy this script in a bin directory (/usr/local/bin) as "md2pdf"
// > (sudo) chmod a+x /usr/local/bin/md2pdf
// USAGE :
@t8g
t8g / gist:a6567cc839d77041c1ea
Created November 15, 2014 15:08
dockeriser un proxy
Exposé du problème :
* private1.com et private2.com ne sont accessibles que via vpn
* je ne veux pas connecter directement mon pc au vpn
Idée (qui marche avec un virtualbox) :
1. Créer un dock avec
* une connexion au vpn