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 / wat
Created November 9, 2011 16:39
I SMELL A BUG THERE
switch (obj) {
case 'y' : tween = new TWEEN.Tween(camera.position).to({x:camera.position.x-to}, 2000).delay(0).easing(TWEEN.Easing.Circular.EaseOut).onUpdate( function() {}).start(); break;
case 'x' : tween = new TWEEN.Tween(camera.position).to({z:camera.position.z-to}, 2000).delay(0).easing(TWEEN.Easing.Circular.EaseOut).onUpdate( function() {}).start(); break;
}
@jbilcke
jbilcke / libxmljs_node0.6
Created November 12, 2011 15:28
LibXMLjs for Node.JS 0.6.x
npm install https://github.com/shtylman/libxmljs/tarball/master
@jbilcke
jbilcke / common-coffee
Created December 8, 2011 17:26
common-coffee
# with common-node
httpclient = require "httpclient"
exports.app = ->
status: 200
headers: {}
body: new httpclient.HttpClient(url: "http://google.com").finish().body
# without
http = require "http"
http.createServer((req, res) ->
# wait / don't wait
wait = (t=0) -> (f) -> setTimeout f, t
async = (f) -> setTimeout f, 0
# simple shortcut
log = console.log
class Main
compute: (a,b) -> a*b + a*b
@jbilcke
jbilcke / swag.coffee
Created October 14, 2012 13:28
chain coffeescript functions like this -> "a b c d e" (yep, no parenthesis or ->)
#!/usr/bin/env coffee
###########
# old way #
###########
# functions
a = (x) -> (g) -> g x * x
b = (x) -> (g) -> g x + x
c = (x) -> (g) -> g x * 100
@jbilcke
jbilcke / d3-radial-tree-bug
Created November 15, 2012 09:33
fix for the d3.js radial tree bug (when there is only 1 child on the root)
importScripts('../vendor/d3/d3.layout.redux.js')
@onmessage = (msg) ->
tree = msg.data
# the layout has a weird effect
if tree.children.length is 1
for n in tree.children[0].children
tree.children.push ghost: yes, children: []
@jbilcke
jbilcke / create_video.py
Last active July 25, 2023 07:14
How to create a video using Gephi + Scripting plugin + ffmpeg
execfile("/your/path/to/videomaker.py")
videomaker(
ts_min=1352261778000, # "from" timestamp..
ts_max=1352262378000, # .."to" timestamp
frames=20, # number of images in the video. eg 200 frames for a video at 20 frames per seconds = 10 seconds of video
output_prefix="/path/to/output/dir/frame_", # path where to write the png. images will be prefixed with "frame_"
output_format=".png" # you probably want to leave png here
)
@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);
@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 / 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