Skip to content

Instantly share code, notes, and snippets.

@mgax
mgax / drift.py
Last active August 29, 2015 14:25
from math import sin, cos, pi
DEG = pi / 180
POSTS = [
(110, 50),
(210, 75),
(315, 125),
(120, 120),
( 60, 50),
(180, 80),
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node circle {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
@mgax
mgax / nginx.conf
Created May 22, 2015 12:46
nginx static websites config
server {
listen 80;
server_name ~^(?<name>.+)\.static\.devel$;
root /var/local/www-static/$name;
}
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" name="device" datamodel="ecmascript" version="1.0">
<state id="OK">
<state id="on">
<transition target="off" event="device.turnOff"/>
</state>
<state id="off">
<transition target="on" event="device.turnOn"/>
</state>
<transition target="error" event="device.error"/>
.factual-scorecard {
width: 558px;
height: 360px;
position: relative;
font-family: "Open Sans", sans-serif;
}
.factual-scorecard img.factual-scorecard-photo {
position: absolute;
top: 0;
@mgax
mgax / graph.json
Created January 14, 2015 15:49
KLayJS bug
{
"children": [
{
"id": "A",
"children": [
{
"id": "B",
"labels": [{"text": "B"}],
"width": 40,
"height": 40
@mgax
mgax / get_coord.js
Created December 26, 2014 14:29
get coordinates by clicking on d3 svg map
svg.on('click', function() {
var coord = projection.invert([d3.event.x, d3.event.y]);
window.prompt('copy', '['+[d3.round(coord[0], 2), d3.round(coord[1], 2)]+']');
});
@mgax
mgax / facebook-messages.css
Last active August 29, 2015 14:09
Fluid styles
/* https://gist.github.com/cmod/1d00fc552d21d5dfdd65 */
#rightCol { display: none !important; }
#pagelet_bluebar { display: none !important; }
#pagelet_dock { display: none !important; }
#pagelet_sidebar { display: none !important; }
#globalContainer { padding-right: 0 !important; }
.fbx #globalContainer { width: auto !important; }
@mgax
mgax / gist:ac42a04b46f653aca643
Created October 4, 2014 09:20
DD-WRT VLAN (TP-Link TL-WR740N v4)
swconfig dev eth1 show
swconfig dev eth1 set enable_vlan 1
swconfig dev eth1 set apply