Skip to content

Instantly share code, notes, and snippets.

View ddneat's full-sized avatar
👋
hello

David Neubauer ddneat

👋
hello
View GitHub Profile
@ddneat
ddneat / sutherland–hodgman.js
Created December 2, 2022 18:32 — forked from alenaksu/sutherland–hodgman.js
Sutherland–Hodgman algorithm
function isInside(p, [a, b]) {
return (b[0] - a[0]) * (p[1] - a[1]) > (b[1] - a[1]) * (p[0] - a[0]);
}
function getEdges(polygon) {
let edges = [];
for (let i = 0; i < polygon.length; i++) {
let edge = [polygon[(i + polygon.length - 1) % polygon.length], polygon[i]];
@ddneat
ddneat / latency.txt
Created November 16, 2017 15:04 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ddneat
ddneat / .vimrc
Last active April 13, 2017 12:56
.vimrc
" Options
set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab
set number
set ignorecase
set hlsearch
set noeb vb t_vb=
set wildmenu
@ddneat
ddneat / scaling-web-scraper.md
Last active October 29, 2016 11:10
Scaling Web Scraper
@ddneat
ddneat / css-naming-convention.md
Last active May 9, 2016 06:58
CSS naming convention (BEM)

CSS Naming Convention (BEM)

COMPONENTS

A page module that has a certain purpose and is a wrapper for it’s children, in example a modal or a slider can be a component. Components use a name:

  • .component {}
  • .component-name {}
// if you would like to use the custom easing you need to use following dependency
// http://gsgd.co.uk/sandbox/jquery/easing/
$('.scroll').on('click', 'a', function(event){
event.preventDefault();
var target = $(this).attr('href');
$('html, body').animate({
scrollTop: $(target).offset().top - $('header').height()
}, 700, 'easeInOutCubic' );
});
@ddneat
ddneat / ubuntu-basic-setup.md
Last active May 9, 2016 07:09
ubuntu basic install process

Server: Ubuntu 10.04 / 64 bit, User: root

update packages

apt-get upgrade
apt-get update

=================================================================

@ddneat
ddneat / howto
Created June 16, 2014 19:31
how to install manymes-chrome-extension
download and unzip manymes-chrome-extension.zip
open chrome://extensions/
activate developer mode (checkbox)
press load unpacked extensions...
choose the unpacked manymes-crhome-extension folder
# Flatten a transparent image with a white background:
convert -flatten img1.png img1-white.png
# Make an image transparent
convert -transparent '#FFFFFF' nontransparent.gif transparent.png
# convert an image into tiles
convert -size 3200x3200 tile:single_tile.png final.png
# making a montage from a collection of images
@ddneat
ddneat / curl-loops.md
Last active May 9, 2016 07:11
curl multiple files from lorempixel and rename them

curl multiple files

curl -O -v --cookie "insert_cookie" https://images-url.com/?id=[0-10]

lorempixel with custom name

for i in {1..10}; do wget -O $i.jpg http://lorempixel.com/512/512; done;

download from lorempixel

for i in {1..100}; do wget http://lorempixel.com/512/512; done

rename multiple files