Skip to content

Instantly share code, notes, and snippets.

View bootstrap.php
<?php
// this is in the `/config` folder
$app->on("collections.save.before.aktuelles", function($name, &$entry, $isUpdate) use ($app) {
// generate slug on create only or when an existing one is empty
if (!$isUpdate || ($isUpdate && trim($entry['slug']) == '')) {
// generate slug based on entry name
$slug = Str::slug($entry['name']);
View gist:3467a28e274f03fd9dfe20b2a6f7feca
# this is a copay/paste combination of https://gist.github.com/nictuku/13afc808571e742d3b1aaa0310ee8a8d & https://gist.github.com/Rahul91/f051a391fac62ccebb581370b0ac644d
# so that we can install virtualbox via apt-get
for x in xenial xenial-security xenial-updates; do
egrep -qe "deb-src.* $x " /etc/apt/sources.list || echo "deb-src http://archive.ubuntu.com/ubuntu ${x} main universe" | sudo tee -a /etc/apt/sources.list
done
echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" | sudo tee -a /etc/apt/sources.list.d/virtualbox.list
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
# allow us to make a kernel
@fabianmu
fabianmu / Dockerfile
Last active Jun 19, 2017
host an adonis js app on a laravel forge server via docker compose
View Dockerfile
FROM node:7
RUN useradd --user-group --create-home --shell /bin/false app
ENV HOME=/home/app
COPY package.json $HOME/
RUN chown -R app:app $HOME/*
USER root
WORKDIR $HOME
View keybase.md

Keybase proof

I hereby claim:

  • I am fabianmu on github.
  • I am fabianmu (https://keybase.io/fabianmu) on keybase.
  • I have a public key whose fingerprint is 2B41 3AE6 3AFF 0E86 69B5 7FC9 9FB4 EF5A E9D7 1ABD

To claim this, I am signing this object:

@fabianmu
fabianmu / RoleAndPermissionSeeder.php
Created Nov 27, 2015
laravel role based permission acl sample
View RoleAndPermissionSeeder.php
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\App;
use App\Role;
use App\Permission;
use App\User;
class RoleAndPermissionSeeder extends Seeder
@fabianmu
fabianmu / html.html
Last active Aug 29, 2015
toggle button
View html.html
<div class="toggle-button respond-toggle" data-service="respond">
<span class="toggle-button-switch"></span>
<span class="toggle-button-label" data-off="no" data-on="yes"></span>
<%= hidden_field_tag "respond", "false", :'data-service' => "respond" %>
</div>
View Envoy.blade.php
{{-- Define all our servers --}}
@servers(['staging' => '', 'production' => ''])
@setup
{{-- The timezone your servers run in --}}
$timezone = 'Europe/Amsterdam';
{{-- The base path where your deployments are sitting --}}
$path = '/var/www/site.com/htdocs';
View gist:5505444
#!/usr/bin/env bash
# call like this on the target server:
# NODENAME='foo' CHEF_ENV='production' RUNLIST='["role[foo]","recipe[bar]"]' CHEFREPO='git@example.com:repo.git' bash <( curl -L https://raw.github.com/gist/1026628 )
# You will need to ensure that the ssh key is already set up on the server.
set -e
export WWW_DIR="/var/www"
export CHEF_DIR="/var/www/html"
sudo rm -rf $CHEF_DIR