Skip to content

Instantly share code, notes, and snippets.

View tobz-nz's full-sized avatar
💥
Boom!

Toby Evans tobz-nz

💥
Boom!
View GitHub Profile
@tobz-nz
tobz-nz / _tabs.js
Last active October 14, 2025 03:59
A super simple pair of tab custom elements
customElements.define('tab-control', class extends HTMLElement {
#tabWindows = []
connectedCallback() {
this.addEventListener(this.on, this)
// Set the initial active tab window
Array.from(this.#tabWindows)
.find(tabWindow => tabWindow.value === this.activeTab)
@tobz-nz
tobz-nz / character-count.js
Last active October 14, 2025 04:01
A simple input character count custom element
customElements.define('character-count', class extends HTMLElement {
#target = null;
connectedCallback() {
this.#target = document.getElementById(this.getAttribute('for'));
if (this.#target) {
this.#target.addEventListener('input', this);
this.value = this.#target.value;
@tobz-nz
tobz-nz / InstallScheduler.php
Last active May 18, 2023 01:18
An Artisan command to install/setup the Laravel Task Scheduler. It supports both Linux and Windows.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Process;
class InstallScheduler extends Command
{
/**
@tobz-nz
tobz-nz / Base.php
Created June 10, 2019 00:35
A small base class taking on some of the basic foundations of an Eloquent Model
<?php
namespace App\Models;
use ArrayAccess;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Database\Eloquent\Concerns\HasAttributes;
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
use Illuminate\Database\Eloquent\JsonEncodingException;
### Keybase proof
I hereby claim:
* I am tobz-nz on github.
* I am t0bz (https://keybase.io/t0bz) on keybase.
* I have a public key whose fingerprint is 86BF D1CB 51FE 9140 518D F4C3 C798 45A3 0CC1 29F9
To claim this, I am signing this object:
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Specify your defaults in this environment variable
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
# install all the things
brew install git httpie homebrew/php/php56 homebrew/php/php56-mcrypt composer nodejs zsh zsh-completions
brew cask install dropbox alfred vagrant vagrant-manager virtualbox mailbox sublime-text flux 1password firefox google-chrome sequel-pro slack --appdir=/Applications
@tobz-nz
tobz-nz / createSimpleTextFieldInEE.sql
Last active August 29, 2015 14:14
Create a simple text field for Expressionengine via sql
SET @fieldGroupId = 1; -- your field group id
SET @fieldName = 'Your_field_name';
SET @fieldUrlLabel = 'Your Field Label';
-- create the field record
INSERT INTO `exp_channel_fields` (`site_id`, `group_id`, `field_name`, `field_label`, `field_instructions`, `field_type`, `field_list_items`, `field_pre_populate`, `field_pre_channel_id`, `field_pre_field_id`, `field_ta_rows`, `field_maxl`, `field_required`, `field_text_direction`, `field_search`, `field_is_hidden`, `field_fmt`, `field_show_fmt`, `field_order`, `field_content_type`, `field_settings`)
VALUES (1, @fieldGroupId, @fieldName, @fieldUrlLabel, '', 'text', '', '0', 0, 0, 6, 128, 'y', 'ltr', 'n', 'n', 'none', 'n', 9, 'any', 'YTo3OntzOjE4OiJmaWVsZF9jb250ZW50X3R5cGUiO3M6MzoiYWxsIjtzOjE4OiJmaWVsZF9zaG93X3NtaWxleXMiO3M6MToibiI7czoxOToiZmllbGRfc2hvd19nbG9zc2FyeSI7czoxOiJuIjtzOjIxOiJmaWVsZF9zaG93X3NwZWxsY2hlY2siO3M6MToibiI7czoyNjoiZmllbGRfc2hvd19mb3JtYXR0aW5nX2J0bnMiO3M6MToibiI7czoyNDoiZmllbGRfc2hvd19maWxlX3NlbGVjdG9yIjtzOjE6Im4iO3M6MjA6ImZpZWxkX3Nob3dfd3JpdG
@tobz-nz
tobz-nz / snippet.txt
Created October 28, 2012 20:41
chrome live console.log fix
console.echo = function(input) {
var output = JSON.parse(JSON.stringify(input));
console.log(output);
}
var asd = {'changed': false};
console.echo(asd);
asd.changed = true;
console.echo(asd);