Skip to content

Instantly share code, notes, and snippets.

<style>
#forkongithub
a {
background: rgb(255, 0, 0);
color: #fff;
text-decoration: none;
font-family: arial, sans-serif;
text-align: center;
font-weight: bold;
padding: 5px 40px;
@bperel
bperel / d3.js
Last active December 17, 2015 08:28
forceCompositeObjects
d3 = function() {
var π = Math.PI, ε = 1e-6, d3 = {
version: "3.0.6"
}, d3_radians = π / 180, d3_degrees = 180 / π, d3_document = document, d3_window = window;
function d3_target(d) {
return d.target;
}
function d3_source(d) {
return d.source;
}
@bperel
bperel / composite.js
Last active December 17, 2015 08:29 — forked from anonymous/composite.js
var force = d3.layout.force()
.gravity(0.2)
.charge(-150)
.linkDistance(300)
.size([800, 600]);
var svg = d3.select("body").append("svg:svg")
.attr("id","graph")
.attr("width", 800)
.attr("height", 600);
@bperel
bperel / gist:60028f5fe6633e6e427d
Created September 3, 2013 11:42
jquery.chosen with Ajax support
// Chosen, a Select Box Enhancer for jQuery and Prototype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 0.14.0
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `grunt build`, do not edit it by hand.
// Diff pour support Ajax :
#!/bin/bash
# Pre-commit hook to make a mysql dump right before committing and add it to the commit.
#
## Change the following values to suit your local setup.
# The name of a database user with read access to the database.
DBUSER=root
# The password associated with the above user. Leave commented if none.
#DBPASS=seekrit
# The database associated with this repository.
DBNAME=dplay
@bperel
bperel / mysqldump_pre_commit_hook.bash
Last active December 31, 2015 23:29 — forked from nuclearsandwich/mysqldump_pre_commit_hook.bash
Support table filtering and custom MySQL path, removes the "Dump completed on..." line
#!/bin/bash
# Pre-commit hook to make a mysql dump right before committing and add it to the commit.
#
## Change the following values to suit your local setup.
# The name of a database user with read access to the database.
#Uncomment if mysqldump is not in your path
#MYSQLPATH=c:/wamp/bin/mysql/mysql5.5.24/bin
#Comment if mysqldump is in your path
@bperel
bperel / gist:9663453
Created March 20, 2014 13:14
Sparql query
SELECT * WHERE {
?e <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Former_empires>
. ?e <http://dbpedia.org/ontology/foundingYear> ?date1
. ?e <http://dbpedia.org/ontology/dissolutionYear> ?date2
. ?e <http://dbpedia.org/property/imageMap> ?imageMap
. OPTIONAL {
?e <http://dbpedia.org/ontology/foundingDate> ?date3
. ?e <http://dbpedia.org/ontology/dissolutionDate> ?date4
}
}
@bperel
bperel / gist:9915616
Created April 1, 2014 14:47
PhantomJs video capture
time ./phantomjs-1.9.7-linux-x86_64/bin/phantomjs test.js |ffmpeg -c:v png -f image2pipe -r 10 -i - -y test.mp4
@bperel
bperel / German_Empire_1914.svg
Last active August 29, 2015 13:58
Superimposed maps
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bperel
bperel / vmware_clear_cache.sh
Created August 4, 2014 15:37
Clear VMWare disk cache
#!/bin/bash
### BEGIN INIT INFO
# Provides: Handle caching page issues with vmware hgfs share
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Handle caching page issues with vmware hgfs share
# Description: Handle caching page issues with vmware hgfs share