Skip to content

Instantly share code, notes, and snippets.

View jbilcke's full-sized avatar
🦫
building something

Julian Bilcke jbilcke

🦫
building something
View GitHub Profile
@jbilcke
jbilcke / graph.js
Created April 29, 2017 14:48
Vis.js graph component for Idyll
const React = require('react');
const IdyllComponent = require('idyll-component');
const Graph = require('react-graph-vis').default;
const options = {
layout: {
hierarchical: true
},
edges: {
color: "#000000"
Unicode = {
/* Strings to match Unicode characters in the BMP according to their Unicode category.
Extracted from Unicode specification, version 5.0.0, source:
http://unicode.org/versions/Unicode5.0.0/
*/
/*
Abbr Long Description
Lu Uppercase_Letter an uppercase letter
Ll Lowercase_Letter a lowercase letter
Lt Titlecase_Letter a digraphic character, with first part uppercase
'use strict'
import React, { Component, PropTypes } from 'react'
import { findDOMNode } from 'react-dom'
import c3 from 'c3'
import 'c3/c3.css'
const emptyFunc = () => {};
@jbilcke
jbilcke / array.js
Last active August 23, 2016 09:44
Array<Array>, Array<{}> or Array<Object>? tests made with node 6.3.0 on a mac
// Execution time: 1048
// { rss: 1028186112, heapTotal: 1015271424, heapUsed: 969132048 }
var start = new Date().getTime();
var arr = [];
for (i = 0; i < 10000000; ++i) {
arr.push([Math.random(), Math.random()])
}
@jbilcke
jbilcke / total.js
Created March 7, 2016 11:01
Calcul du total par personne
function total(opts){
var plats = opts.plats.reduce((r,p) => r + p)
return plats + (opts.livraison / opts.nbPersonnes) - (plats * opts.reduction)
}
total({
plats: [3.10, 8.20, 0.30], // prix des plats d'une personne
livraison: 1.50, // 12h-13h
reduction: 0.15, // 15%

Keybase proof

I hereby claim:

  • I am jbilcke on github.
  • I am jbilcke (https://keybase.io/jbilcke) on keybase.
  • I have a public key whose fingerprint is 47AA F05A C297 E551 759B 1F43 8196 921E 4F86 F8A8

To claim this, I am signing this object:

@jbilcke
jbilcke / gist:6537280
Created September 12, 2013 13:26
"It is possible to stream a request directly to a Node.js Stream object by calling the createReadStream() method on a request. " http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/makingrequests.html
(new AWS.S3()).getObject(Bucket: 'myBucket', Key: 'myImageFile.jpg').createReadStream().pipe(require('fs').createWriteStream('/path/to/file.jpg'))
@jbilcke
jbilcke / run.sh
Created August 28, 2013 08:08
How to run Gephi from sources
#!/bin/bash
cd modules/application && mvn nbm:cluster-app nbm:run-platform
@jbilcke
jbilcke / after.coffee
Created July 31, 2013 22:10
wrapper for checking returned values in coffee
result = do (value=some(operation(42))) ->
throw Error "too low" if value < 0.5
value
@jbilcke
jbilcke / ios7_bookmarklet
Last active December 18, 2015 12:19
Add some iOS7 swag to your website
javascript: WebFontConfig = { google: { families: [ 'Lato:100,300:latin' ] } };(function() { var wf = document.createElement('script'); wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';wf.type = 'text/javascript'; wf.async = 'true'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wf, s); })();var css = document.createElement("style");css.type ="text/css"; css.innerHTML ="body { filter: saturate(400%); -webkit-filter: saturate(400%); -moz-filter: saturate(400%); -o-filter: saturate(400%); -ms-filter: saturate(400%); font-family: 'Lato', sans-serif !important; font-weight; 300; }"; document.body.appendChild(css);