Skip to content

Instantly share code, notes, and snippets.

View gasp's full-sized avatar
🔧
hacking stuff

Gaspard Beernaert gasp

🔧
hacking stuff
View GitHub Profile
@gasp
gasp / split.js
Created July 19, 2012 18:09
run it with nodejs
//
// split.js
// parse large files by new lines.
// uses buffer for very long lines
//
// Created by gaspard on 2012-07-19.
// wtfpl
//
@gasp
gasp / mamp.sh
Created July 21, 2012 22:29
useful mamp terminal controller
# /bin/sh
case $1 in
start)
/Applications/MAMP/bin/startMysql.sh
/Applications/MAMP/bin/startApache.sh
;;
stop)
/Applications/MAMP/bin/stopMysql.sh
/Applications/MAMP/bin/stopApache.sh
@gasp
gasp / strlen.php
Created September 24, 2012 13:21
recursive function
// the shortest strlen function
function cc($s){
if(($ss = substr($s,1))!='') return 1+cc($ss);
else return 1;
}
@gasp
gasp / articles et auteurs liés au projet
Created November 8, 2012 09:44
boucle à refactoriser
<h2>Rôles et auteurs</h2>
<B_equipe>
<ul>
<BOUCLE_equipe(projets_liens){id_projet}>
<BOUCLE_equipe_auteur(AUTEURS){tous}{id_auteur=#ID_OBJET}>
<li>
<a href="#URL_AUTEUR">#NOM</a>
[((#_equipe:ROLE|role{auteur}))]
</BOUCLE_equipe_auteur>
</li>
@gasp
gasp / README.md
Last active December 14, 2015 14:09 — forked from aronwoost/README.md

On my dev server

##Install git

su
apt-get install git-core

##Create ssh directory since it doesn't exists by default on the Amazon AMI

@gasp
gasp / httpClient.js
Created March 16, 2013 12:49
node.js httpClient to test and build cache
var http = require('http');
var cache = {
pages : {},
urls : []
};
var site = {
// hostname: 'oldlaps.freelancis.net',
@gasp
gasp / gist:7257730
Created October 31, 2013 21:44
console polyfill
(function (c) {
'use strict';
var prop, method,
empty = {},
dummy = function() {},
properties = 'memory'.split(','),
methods = ('assert,clear,constructor,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,'
+ 'info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn').split(',');
while (prop = properties.pop()) c[prop] = c[prop] || empty;
while (method = methods.pop()) c[method] = c[method] || dummy;
@gasp
gasp / sockets.js
Created November 1, 2013 15:08
try catch issue for JonathanWi
"use strict";
var WebSocketServer = require('ws').Server;
var serve = function(options) {
var port = options.port || 9802;
var wss = new WebSocketServer({port: port});
console.log('serving socket on http://localhost:'+port)
var users = [];
@gasp
gasp / console_images.js
Last active December 27, 2015 17:19
output all images of the page and give some stats
//
// images summary
// output all images in the page
// quick check on mobile version the images ratios
// (only for images that are included into the dom)
//
(function($,window,document){
var r = {
onepix : [],
dropped: [],
@gasp
gasp / query.osm
Created August 23, 2014 11:02
OSM query for operator=RAPT, is this a singularity ?
<!--
RATP or RAPT ?
-->
<osm-script output="json" timeout="25">
<!-- gather results -->
<union>
<!-- query part for: “operator=rapt” -->
<query type="node">
<has-kv k="operator" v="RAPT"/>
<bbox-query s="48.8326901185081" w="2.325925827026367" n="48.86477122456225" e="2.379741668701172"/>