Skip to content

Instantly share code, notes, and snippets.

View dapx's full-sized avatar
🤔
Thinking about many things

Daniel André da Silva dapx

🤔
Thinking about many things
View GitHub Profile
@dapx
dapx / AngleDegrees.js
Last active May 3, 2020 22:11
Calculate an angle direction in a two-dimensional plane
const toRadians = (inDegrees) => (inDegrees * Math.PI) / 180
/**
* Calculate an angle direction in a two-dimensional plane
* @param {degrees} 360º [0 -> [x=1 y=0], 90 -> [x=0 y=1], 180 -> [x=-1 y=0]]
*/
function calculateDirection(degrees) {
const angle = toRadians(degrees)
const x = Math.round(Math.cos(angle))
const y = Math.round(Math.sin(angle))
@dapx
dapx / rename_phoenix_project.sh
Created May 15, 2019 01:29 — forked from krystofbe/rename_phoenix_project.sh
rename a phoenix 1.3 project
#!/bin/bash
set -e
CURRENT_NAME="Zauberantrag"
CURRENT_OTP="zauberantrag"
NEW_NAME="Wunderantrag"
NEW_OTP="wunderantrag"
@dapx
dapx / xvfb
Created October 11, 2016 19:59 — forked from jterrace/xvfb
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)