Skip to content

Instantly share code, notes, and snippets.

View jacekd's full-sized avatar

Jacek Dominiak jacekd

View GitHub Profile
@jacekd
jacekd / index.html
Created November 16, 2016 18:52
threats catalogue
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>threat catalogue</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.3.1/lodash.min.js"></script>
<style>
.link {
stroke-width: 1px;
@jacekd
jacekd / index.html
Last active August 29, 2015 14:21
tree js
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>d3 three</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.3.1/lodash.min.js"></script>
<style>
.link {
stroke-width: 1px;
@jacekd
jacekd / latex.css
Created March 14, 2015 13:17
Latex css file
body {
font-family:garamond, helvetica;
margin: 4em 5em 10em 5em;
width: 60%;
max-width: 50em;
text-align: justify;
text-justify: newspaper;
}
a:link { text-decoration:underline; border-width: 0px; }
@jacekd
jacekd / mongodb.js
Last active August 29, 2015 14:16
mongodb explorer
/**
* Main Server file
* @description: this file should iterate over the collections with filters if ones are passed and retrieve the data
* @author: Jacek Dominiak
* @copyright: Jacek Dominiak
* @created: 11/03/15
*/
// ---------------------------------
// import config
@jacekd
jacekd / index.html
Last active August 29, 2015 14:16
d3.no.root.multiple.parents.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>d3 three</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.3.1/lodash.min.js"></script>
<style>
.link {
stroke-width: 1px;
@jacekd
jacekd / README.md
Last active February 17, 2018 21:46 — forked from mbostock/.block

Say your dataset is an array of numbers, and includes both positive and negative values. Use two scales to construct the bar chart: a quantitative scale (such as a [linear scale][1]) to compute the bar positions along the x-axis, and an [ordinal scale][2] with rangeBands to compute the bar positions along the y-axis.

For the quantitative scale, compute the data domain (the minimum and maximum value) using [d3.extent][3]:

var x = d3.scale.linear()
    .domain(d3.extent(data, function(d) { return d.value; }))
    .range([0, width]);

[Nicing][4] the scale will extend the extent slightly to the nearest round numbers. If you want the zero-value to be centered in the middle of the canvas, take the greater of the minimum and maximum value by magnitude, or simply hard-code the desired domain.

@jacekd
jacekd / .tmux.conf
Created July 7, 2014 18:00
mouse toggle settings
# disable mouse control by default - change 'off' to 'on' to enable by default.
setw -g mode-mouse off
set-option -g mouse-resize-pane off
set-option -g mouse-select-pane off
set-option -g mouse-select-window off
# toggle mouse mode to allow mouse copy/paste
# set mouse on with prefix m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
@jacekd
jacekd / 2048-random.js
Created March 14, 2014 08:04
2048 - random arrow play
function fireKey()
{
if(document.createEventObject)
{
var eventObj = document.createEventObject();
eventObj.keyCode = Math.floor(Math.random() * (40 - 37 + 1)) + 37;
document.fireEvent("onkeydown", eventObj);
}else if(document.createEvent)
{
var eventObj = document.createEvent("Events");
@jacekd
jacekd / 2048-circle.js
Last active February 17, 2018 21:42
2048 keys in circle moves
function mouseEvent(type, sx, sy, cx, cy) {
var evt;
var e = {
bubbles: true,
cancelable: (type != "mousemove"),
view: window,
detail: 0,
screenX: sx,
screenY: sy,
clientX: cx,
@jacekd
jacekd / mongo.coffee
Created December 8, 2013 20:02
basic REST API
mongoose = require 'mongoose'
model = require '../models/mongo'
Mongo = mongoose.model('Mongo', model.mongoSchema)
exports.list = (req, res) ->
Mongo.find (err, object) ->
return res.json 500, { status: '500', message: 'Intestnal Exception Error' } if (err)
res.json 200, { status: '200', message: object }
exports.create = (req, res) ->