Skip to content

Instantly share code, notes, and snippets.

View xewl's full-sized avatar
👁️‍🗨️

Ken Verhaegen xewl

👁️‍🗨️
View GitHub Profile
@jhoff
jhoff / Enums.php
Last active July 20, 2025 00:04
Laravel Model Enumeration Trait
<?php
namespace App\Traits;
use Illuminate\Support\Str;
use App\Exceptions\InvalidEnumException;
trait Enums
{
/**
@yassermog
yassermog / MY_Input.php
Last active August 1, 2018 10:00 — forked from nambok/MY_Input.php
Extends codeigniter input class to accept put and delete requests ........ Just Put this file in application/core/MY_Input.php ........ NOW you can $data=$this->input->put('key');
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input {
/**
* Variables
*
*/
protected $delete;
@fletcherist
fletcherist / CpuMeter.js
Created October 11, 2017 15:13
CPU Metrics for Chrome Extensions
((name, context = window, func) => { context[name] = func() })
('CpuMeter', this, () => {
const isEmptyObject = object => Object.keys(object).length === 0
const getProcessorUsage = (usage, oldUsage) =>
Math.floor((usage.kernel + usage.user - oldUsage.kernel - oldUsage.user) / (usage.total - oldUsage.total) * 100)
class CpuMeter {
constructor() {
if (!chrome || !chrome.system || !chrome.system.cpu) {
throw new Error(`No access to chrome.system.cpu!
@ekrist1
ekrist1 / Tabs.vue
Created October 18, 2017 19:14
Vue Bulma Laravel Tabs
<template>
<div>
<div class="tabs">
<ul>
<li v-for="tab in tabs" :key="tab.id" :class="{ 'is-active': isActivated(tab) }"><a @click="selectTab(tab)">{{ tab.name }}</a></li>
</ul>
</div>
</div>
</template>
@Phoenix2k
Phoenix2k / wordpress-custom-tax-columns.php
Created December 12, 2017 14:13
WordPress: Custom taxonomy columns with sorting support
<?php
/**
* This example uses 'main-category' as a custom taxonomy and values
* from Carbon Fields for sorting https://carbonfields.net
*/
// Add custom column title
add_filter( 'manage_edit-main-category_columns', function( $columns ) {
$column_position = 2;
$before = array_slice( $columns, 0, $column_position, true );
@spacepatcher
spacepatcher / Breach Compilation (1.4 billion credentials) in Postgres.md
Last active February 12, 2026 18:51
Breach Compilation (1.4 billion credentials) in Postgres.md
@devotoare
devotoare / .user.ini
Created March 21, 2018 00:52
Wordfence for Trellis/Bedrock
; Wordfence WAF
auto_prepend_file = ‘/srv/www/example.com/current/config/wordfence-waf.php’
; END Wordfence WAF
// On PhpStorm, when ussing with laravel mix, for Alias path resolving in components you have to:
// - create a webpack.config.js file separately like:
const path = require('path')
const webpack = require('webpack')
module.exports = {
...
resolve: {
extensions: ['.js', '.json', '.vue'],
@wdmtech
wdmtech / trim-strings-in-laravel-model-on-save.md
Last active August 18, 2023 14:55
Trim all strings in a Laravel Model before they are saved
public static function boot() {
    parent::boot();

    // Trim all string attributes before they are saved
    static::saving(function($model){
        $attributes = collect($model->getAttributes())->map(function ($attribute) {
            if (is_string($attribute)) {
                return trim($attribute);
 }
@devbynyden
devbynyden / 1_OpenwrtWiFreeGuide.md
Last active November 6, 2023 19:18
Setting up openwrt with Telenet WiFree

Setting up openwrt with Telenet WiFree

This guide explains how to setup your openwrt router to interact with Telenet WiFree as a WISP router.
In this case we will connect to WiFree, create a secondary Wifi signal and also have access to the internet on the Lan interface.
WISP Network
With this setup you can have multiple devices connected to the Telenet WiFree Hotspot.

!Important check the Troubleshooting section at the bottom of this page if LAN does not work.

Disclaimer

I only use this at a secondary home. I am not in any way affiliated with Telenet.