Skip to content

Instantly share code, notes, and snippets.

View woss's full-sized avatar
🛸

Daniel Maricic woss

🛸
View GitHub Profile
function h2dec(hour,min) {
hour = parseInt(hour, 10) || 0
minutes = parseInt(min, 10) || 0
var minuteDecimalToHour = parseInt((min/6)*10, 10)
return parseFloat([hour,minuteDecimalToHour].join('.'))
}
@woss
woss / .block
Last active May 25, 2017 11:21 — forked from mbostock/.block
Force-Directed Tree
license: gpl-3.0
@woss
woss / sort_requirements.py
Created February 15, 2017 18:24 — forked from michaelBenin/sort_requirements.py
Sort requirements pip files or requirements.txt for python dependencies
requirements_file = 'base.pip'
requirements = open(requirements_file, 'r')
content = requirements.read().splitlines()
content = list(set(content))
content.sort(key=lambda y: y.lower())
content = '\n'.join(content)
file = open('sorted_'+requirements_file, 'w')
file.write(content)
@woss
woss / sort_requirements.py
Created February 15, 2017 18:24 — forked from michaelBenin/sort_requirements.py
Sort requirements pip files or requirements.txt for python dependencies
requirements_file = 'base.pip'
requirements = open(requirements_file, 'r')
content = requirements.read().splitlines()
content = list(set(content))
content.sort(key=lambda y: y.lower())
content = '\n'.join(content)
file = open('sorted_'+requirements_file, 'w')
file.write(content)
@woss
woss / pixel-image-data.js
Created May 30, 2016 08:54
crates canvas with onclick event to get value of a clicked pixel
<html>
<head>
</head>
<body>
<img style="display:none" src="image.png" alt="">
<canvas id="canvas" onClick="selectPixel(this,event)"></canvas>
<script>
window.onload = function() {
var myImg = document.querySelector("img");
brew uninstall macvim
brew uninstall vim
brew install macvim --with-cscope --with-lua --HEAD
brew install luajit
brew install vim --with-luajit
@woss
woss / move-js-function
Last active April 4, 2016 12:48
move-js-function
function move(array, oldIndex, newIndex) {
if (newIndex >= array.length) {
newIndex = array.length - 1;
}
array.splice(newIndex, 0, array.splice(oldIndex, 1)[0]);
return array;
}
describe('ArrayHelper', function() {
it('Move right', function() {
### Keybase proof
I hereby claim:
* I am woss on github.
* I am woss (https://keybase.io/woss) on keybase.
* I have a public key ASCIOvreMXBvtKpXx4febUjidog6icRKTyBgQJTTGRQ8IQo
To claim this, I am signing this object:
@woss
woss / dockerfile-nvm
Created January 11, 2016 07:37
Docker and nvm
FROM ubuntu:14.04.3
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN sudo apt-get install -y build-essential libssl-dev
@woss
woss / dropzone-directive.js
Created December 31, 2015 11:05 — forked from compact/dropzone-directive.js
AngularJS directive for Dropzone.js
/**
* An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/
*
* Usage:
*
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>