Skip to content

Instantly share code, notes, and snippets.

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

Ken Verhaegen xewl

👁️‍🗨️
View GitHub Profile
@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 );
@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>
@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!
@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;
@jhoff
jhoff / Enums.php
Last active August 27, 2024 09:51
Laravel Model Enumeration Trait
<?php
namespace App\Traits;
use Illuminate\Support\Str;
use App\Exceptions\InvalidEnumException;
trait Enums
{
/**
@tankbar
tankbar / wp-google-tag-manager
Last active January 23, 2024 11:17
Add Google Tag Manager in WordPress with hooks and actions
<?php
/* ADD GTM TO HEAD AND BELOW OPENING BODY */
add_action('wp_head', 'google_tag_manager_head', 20);
function google_tag_manager_head() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
@PieterScheffers
PieterScheffers / mysql_get_last_updated_id.sql
Created June 21, 2016 10:56
MySQL - Get id of updated rows
# http://stackoverflow.com/questions/1388025/how-to-get-id-of-the-last-updated-row-in-mysql
# single row update
SET @update_id := 0;
UPDATE some_table SET column_name = 'value', id = (SELECT @update_id := id)
WHERE some_other_column = 'blah' LIMIT 1;
SELECT @update_id;
# Multiple rows updated
SET @uids := null;
@kfatehi
kfatehi / _README.md
Created June 5, 2016 03:42
Rebroadcasting an icecast stream to another icecast server with inline transcoding

What?

A one-liner that pulls an AAC stream, pipes it into ffmpeg which transcodes it to mp3, then pipes it into ezstream with your settings (in the xml file) which streams it your radio.

Dependencies

sudo apt-get install ficy ffmpeg ezstream

@mikejolley
mikejolley / gist:3b37b9cc19a774665f31
Last active March 7, 2025 17:35
Example instance based shipping method
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Sample instance based method.
*/
class WC_Shipping_Test_Method extends WC_Shipping_Method {
@joemaller
joemaller / Managed WordPress Hosting .gitignore
Last active August 11, 2023 21:40
A comprehensive .gitignore file for managed WordPress hosts.
# Managed WordPress Hosting .gitignore file for ignoring WordPress files
#
# Most recent revision here:
# https://gist.github.com/joemaller/4f7518e0d04a82a3ca16
#
# Raw Source (for curl):
# https://gist.githubusercontent.com/joemaller/4f7518e0d04a82a3ca16/raw
#
# Used by these WordPress Development environments:
# https://github.com/ideasonpurpose/docker-wordpress-dev