Skip to content

Instantly share code, notes, and snippets.

View ninjaparade's full-sized avatar
🏠
Working from home

Ninja ninjaparade

🏠
Working from home
  • Ninjaparade Digital Inc
  • Near you.
View GitHub Profile
@ninjaparade
ninjaparade / README.md
Created December 18, 2023 02:53 — forked from mrbar42/README.md
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
/**
* Generates a JSON file with all translations.
<?php
namespace App\Http\Middleware;
use Closure;
class SanctumAbilities
{
/**
* Handle an incoming request.
@ninjaparade
ninjaparade / prepare-commit-msg
Created August 27, 2020 19:35
Prefix Commit Messages with "[PROJECT_NAME_IN_CAPS]-[TICKET_NUMER]" from Branch Name
#!/bin/bash
# SOURCE: https://git-scm.com/docs/githooks
# SOURCE: https://gist.github.com/bartoszmajsak/1396344
# get the branch name
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
if [ "$BRANCH_NAME" == "master" ] || [ "$BRANCH_NAME" == "develop" ] || [ "$BRANCH_NAME" == "test" ] || [[ "$BRANCH_NAME" = release* ]]; then
# if "master" or "develop", then exit normally and don't modify the commit
@ninjaparade
ninjaparade / .postcssrc.js
Created August 30, 2018 18:31
Purge CSS in vue cli app
const tailwindcss = require('tailwindcss')
const purgecss = require('@fullhuman/postcss-purgecss')
const autoprefixer = require('autoprefixer')
const postcssImport = require('postcss-import')
module.exports = {
plugins: [
postcssImport,
tailwindcss('./tailwind.js'),
purgecss({
<?php
$posts = new App\Post;
echo $post->id; // won't fail
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use File;
class MakeViewCommand extends Command
{
/**
protected function parseBladeCode($string, array $args = [])
{
$generated = $this->container['blade.compiler']->compileString($string);
ob_start();
extract($args, EXTR_SKIP);
try {
eval('?>' . $generated);
@ninjaparade
ninjaparade / v-selectize.js
Created December 4, 2015 20:34 — forked from james2doyle/v-selectize.js
Selectize dropdown and tags directives for Vue.js
// usage: v-selectize-dropdown="dataKeyToBindTo"
Vue.directive('selectize-dropdown', {
twoWay: true,
priority: 1000,
bind: function () {
var self = this;
$(this.el).selectize({
create: true,
sortField: 'text',
onChange: function (val) {
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);