Skip to content

Instantly share code, notes, and snippets.

View wottpal's full-sized avatar

Dennis Zoma wottpal

View GitHub Profile
@wottpal
wottpal / exp-027.js
Last active February 10, 2018 09:30
* numberOfPoints defines amount of points * respects frameWidth * returns array of triangles in the format [ [[x1, y1],[x2, y2],[x3, y3]], ... ]
function triangulateCanvas() {
let points = [], triangles = []
for (let i = 0; i < numberOfPoints; i++) {
const randomX = random(frameWidth, WIDTH-frameWidth)
const randomY = random(frameWidth, HEIGHT-frameWidth)
points.push([
constrain(randomX, frameWidth, WIDTH-frameWidth),
constrain(randomY, frameWidth, HEIGHT-frameWidth)
@wottpal
wottpal / relative-time.php
Last active April 5, 2025 14:42 — forked from mtttmpl/relative-time.php
Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks'). With the argument $max_diff you can specify the number of days from when the actual date should be returned.
<?php
/**
* Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks').
* With the argument `$max_diff` you can specify the number of days from when the
* actual date should be returned witht the format of `$date_format`.
*
* Gist: https://gist.github.com/wottpal/61bc13425a8cedcd88666040d1449bfd
* Fork of: https://gist.github.com/mattytemple/3804571
*/
@wottpal
wottpal / post-receive
Last active July 22, 2019 09:39
Kirby Git Deploy Hook
#!/bin/bash
# IMPORTANT REQUIREMENTS
# * Make sure the git-user is allowed to perform operations on behalf of
# www-data (without password) by adding this line to `/etc/sudoers`:
# `git ALL=(www-data) NOPASSWD: /usr/bin/git, /bin/mkdir`
# * Make sure `var/www` is owned by www-data:www-data by executing
# `sudo chown -R www-data:www-data /var/www`
# * Add www-data to the git-group by executing `sudo usermod -a -G git www-data`
# * Make sure this file is executable by executing