Skip to content

Instantly share code, notes, and snippets.

View fabianmu's full-sized avatar

Fabian Mu fabianmu

View GitHub Profile
@fabianmu
fabianmu / webhook-runner.js
Last active August 1, 2023 09:24
disable webhook for a strapi model
/**
* The event hub is Strapi's event control center.
*/
'use strict';
const debug = require('debug')('strapi:webhook');
const _ = require('lodash');
const fetch = require('node-fetch');
<?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']);
@fabianmu
fabianmu / gist:3467a28e274f03fd9dfe20b2a6f7feca
Last active November 29, 2020 06:59
Virtualbox 5.2 on scaleway
# 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 June 19, 2017 18:36
host an adonis js app on a laravel forge server via docker compose
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
@fabianmu
fabianmu / keybase.md
Created September 26, 2016 10:03
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 November 27, 2015 12:05
laravel role based permission acl sample
<?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 August 29, 2015 14:10
toggle button
<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>
{{-- 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';
#!/usr/bin/env bash
# call like this on the target server:
# NODENAME='foo' CHEF_ENV='production' RUNLIST='["role[foo]","recipe[bar]"]' CHEFREPO='[email protected]: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