Skip to content

Instantly share code, notes, and snippets.

@miljan-aleksic
miljan-aleksic / Stream.php
Last active December 5, 2023 01:17
Cloudflare Streams - Signed URL php example
<?php
class Stream
{
/**
* Signs a url token for the stream reproduction
*
* @param string $uid The stream uid.
* @param array $key The key id and pem used for the signing.
* @param string $exp Expiration; a unix epoch timestamp after which the token will not be accepted.
@miljan-aleksic
miljan-aleksic / .htaccess
Last active January 5, 2017 04:46
Apache Standard Security Headers
## Security Headers - as recommended at https://securityheaders.io ##
Header Set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header Set Content-Security-Policy "script-src 'self' *.google-analytics.com"
Header Set X-Frame-Options "SAMEORIGIN"
Header Set X-Content-Type-Options "nosniff"
Header Set X-XSS-Protection "1; mode=block"
## Security Headers ##
@miljan-aleksic
miljan-aleksic / calendar-matrix.js
Last active August 19, 2022 12:24
Calendar Matrix (date-fns, ES6) inspired by https://github.com/bclinkinbeard/calendar-matrix
import getYear from 'date-fns/get_year'
import getMonth from 'date-fns/get_month'
import addDays from 'date-fns/add_days'
import startOfWeek from 'date-fns/start_of_week'
const rows = range(6)
const cols = range(7)
/**
* Returns a two-dimensional array with calendar represented dates