Skip to content

Instantly share code, notes, and snippets.

View defenestrator's full-sized avatar

Jeremy Jacob Anderson defenestrator

View GitHub Profile
create table my_test_table (
id int not null auto_increment,
my_char_1 char(10), -- A FIXED length string (can contain letters, numbers, and special characters). The size parameter specifies the column length in characters - can be from 0 to 255. Default is 1
my_varchar_1 varchar(50), -- A VARIABLE length string (can contain letters, numbers, and special characters). The size parameter specifies the maximum column length in characters - can be from 0 to 65535
my_binary_1 binary(16), -- Equal to CHAR(), but stores binary byte strings. The size parameter specifies the column length in bytes. Default is 1
my_varbinary_1 varbinary(32), -- Equal to VARCHAR(), but stores binary byte strings. The size parameter specifies the maximum column length in bytes.
my_tinyblob_1 tinyblob, -- For BLOBs (Binary Large
@defenestrator
defenestrator / laravel_envoyer_migrations_like_a_boss.sh
Last active April 21, 2024 20:08
Laravel Envoyer hook to run migrations in a sane manner
# Application base directory
site= "example.com"
# Navigate to the release being deployed.
cd {{ release }}
# Number of migrations in the new release
releaseMigrations= ls database/migrations | wc -l
# Number of migrations in the current production app
@defenestrator
defenestrator / laravel-forge-deploy.sh
Last active April 22, 2021 18:29 — forked from tonioriol/laravel-forge-deploy.sh
Laravel Forge zero downtime deployment script
# stop script on error signal
set -e
SITE="example.com"
DEPL="/home/forge/deployments/${SITE}"
# create directory and any intermediate directories if don't exist
mkdir -p ${DEPL}
CUR="/home/forge/${SITE}"
NEW="${DEPL}/new"
BKP="${DEPL}/backup"
@defenestrator
defenestrator / awesome_favorite_fizzbuzz.js
Last active May 17, 2022 04:45
Some Fizzbuzz for meditation
// This one is interesting because no previously checked condition is re-checked
// It is a self-executing function that contains a declarative function named fizzbuzz() and a for loop
// Too much fun
(function() {
function fizzbuzz(i) {
const test = (d, s, x) => i % d == 0 ? _ => s + x('') : x
const fizz = x => test(3, 'Fizz', x)
const buzz = x => test(5, 'Buzz', x)
console.log(fizz(buzz(x=>x))(i.toString()))
}
@defenestrator
defenestrator / package.json
Last active June 30, 2022 13:52
Laravel Tailwind and Svelte 3: simple configuration.
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
@defenestrator
defenestrator / pure_html_css_modal.css
Created May 8, 2019 18:21 — forked from calebporzio/pure_html_css_modal.css
The CSS for the pure HTML/CSS modal I tweeted about.
details summary {
cursor: pointer;
outline: none !important;
display: inline-block;
padding: 8px 12px;
padding-top: 10px;
border-radius: 4px;
overflow: hidden;
background: #F09825;
color: white;
<?php
/*
//Normal query
User::all();
//Cached query (default 60min)
User::cached()->all();
//Cached query (5min)
@defenestrator
defenestrator / state-abbr.js
Created October 28, 2016 17:45
Two-way State/Abbreviation Transformer
function convert_state(name, to) {
var name = name.toUpperCase();
var states = new Array( {'name':'Alabama', 'abbrev':'AL'}, {'name':'Alaska', 'abbrev':'AK'},
{'name':'Arizona', 'abbrev':'AZ'}, {'name':'Arkansas', 'abbrev':'AR'}, {'name':'California', 'abbrev':'CA'},
{'name':'Colorado', 'abbrev':'CO'}, {'name':'Connecticut', 'abbrev':'CT'}, {'name':'Delaware', 'abbrev':'DE'},
{'name':'Florida', 'abbrev':'FL'}, {'name':'Georgia', 'abbrev':'GA'}, {'name':'Hawaii', 'abbrev':'HI'},
{'name':'Idaho', 'abbrev':'ID'}, {'name':'Illinois', 'abbrev':'IL'}, {'name':'Indiana', 'abbrev':'IN'},
{'name':'Iowa', 'abbrev':'IA'}, {'name':'Kansas', 'abbrev':'KS'}, {'name':'Kentucky', 'abbrev':'KY'},
{'name':'Louisiana', 'abbrev':'LA'}, {'name':'Maine', 'abbrev':'ME'}, {'name':'Maryland', 'abbrev':'MD'},
{'name':'Massachusetts',
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@defenestrator
defenestrator / _social-colors-2014.scss
Created September 27, 2015 00:07 — forked from math-is-hard/_social-colors-2014.scss
Social Network Colors (2014)
/* Social
======================================================================================= */
$col-addthis : #fe6d4c;
$col-blogger : #fb8f3d;
$col-dribbble : #ea4c89;
$col-facebook : #3b5998;
$col-flickr : #ff0084;
$col-forrst : #5B9A68;
$col-foursquare : #0072b1;
$col-googleplus : #dd4b39;