Skip to content

Instantly share code, notes, and snippets.

@dayfuaim
dayfuaim / closure_table.md
Created June 8, 2016 20:18
Persistent tree structure using closure table in MySQL

Using closure tables to manage hierarchical relations in MySQL

Create DB tables

Create a table to represent tree nodes.

CREATE TABLE `tree_node` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `data_body` text,

node_deleted datetime DEFAULT NULL,

#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@dayfuaim
dayfuaim / gist:0001d084157b562c89224b678ff98c3b
Created December 26, 2018 17:02 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
pm list packages -f
@dayfuaim
dayfuaim / mojo-vue.pl
Created April 29, 2019 19:57 — forked from Tekki/mojo-vue.pl
Mojolicious - Vue.js Example
#!/usr/bin/env perl
use Mojolicious::Lite -signatures;
get '/' => sub ($c) {
$c->render(template => 'index');
};
get '/api/:region' => sub ($c) {
my %regions = (
@dayfuaim
dayfuaim / AlbumsOrder.scpt
Last active March 7, 2020 13:00 — forked from jkbockstael/AlbumsOrder.scpt
AppleScript to get iTunes to sort albums by release date
-- Fix albums display order
-- Changes the "sort album" field, to ensure that albums get displayed in chronological order on iPods.
-- CC-BY-NC 2011, Jean-Karim Bockstael,
tell application "iTunes"
-- input checking
if selection is {} then
display dialog "You must select at least a track"
return
else
set selected_tracks to selection
@dayfuaim
dayfuaim / mpv.conf
Created July 30, 2020 15:44 — forked from shabbir-hasan/mpv.conf
MPV Configuration (mpv.conf) on Windows 10 Pro
# vim: syntax=config
###########
# General #
###########
priority=high
input-ipc-server=/tmp/mpvsocket # listen for IPC on this socket
load-stats-overlay=yes # use local stats.lua
@dayfuaim
dayfuaim / gresource-extract
Created April 1, 2021 10:16 — forked from AnwarShah/gresource-extract
Gresource-extract. Original Credit goes to the author here http://projects.thecodergeek.com/scripts/gresource-extract
#!/bin/bash
##############################################################################
# Author: Peter Gordon <[email protected]>
# License: Public Domain
##############################################################################
# gresource-extract.sh
# Version: 1
#
# This Bash script is designed to extract all resource files in a given
# GResource file, with the given base folder. For example, if a GResource file
@dayfuaim
dayfuaim / checkForUndefinedCSSClasses.js
Created June 18, 2021 12:24 — forked from broofa/checkForUndefinedCSSClasses.js
ES module for detecting undefined CSS classes (uses mutation observer to monitor DOM changes). `console.warn()`s undefined classes.
/**
* Sets up a DOM MutationObserver that watches for elements using undefined CSS
* class names. Performance should be pretty good, but it's probably best to
* avoid using this in production.
*
* Usage:
*
* import cssCheck from './checkForUndefinedCSSClasses.js'
*
* // Call before DOM renders (e.g. in <HEAD> or prior to React.render())
@dayfuaim
dayfuaim / script-template.sh
Created November 19, 2021 10:48 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@dayfuaim
dayfuaim / wordle-answers-alphabetical.txt
Created February 14, 2022 16:28 — forked from cfreshman/wordle-answers-alphabetical.txt
Wordle answers from source code in alphabetical order. And if you write a solver, here's a leaderboard! https://freshman.dev/wordle/#/leaderboard
aback
abase
abate
abbey
abbot
abhor
abide
abled
abode
abort