Skip to content

Instantly share code, notes, and snippets.

@miljan-aleksic
miljan-aleksic / Stream.php
Last active Aug 4, 2021
Cloudflare Streams - Signed URL php example
View Stream.php
<?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 Jan 5, 2017
Apache Standard Security Headers
View .htaccess
## 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 ##
View calendar-matrix.js
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