Skip to content

Instantly share code, notes, and snippets.

View joshlewis's full-sized avatar

Josh Lewis! joshlewis

View GitHub Profile
@Jany-M
Jany-M / wp_ics.php
Last active September 19, 2023 03:15 — forked from jakebellacera/ICS.php
[WP] Generate a downloadable .ics file from any WordPress post or custom post type
<?php
/*
For a better understanding of ics requirements and time formats
please check https://gist.github.com/jakebellacera/635416
*/
// UTILS
// Check if string is a timestamp
@martinbean
martinbean / pre-commit
Last active December 19, 2023 22:14
Pre-commit hook to detect if any .php files contain dd()
#!/usr/bin/php
<?php
$files = shell_exec('git diff-index --name-only --cached --diff-filter=ACMR HEAD | grep "\.php$"');
$files = explode("\n", trim($files));
$exitCode = 0;
foreach ($files as $file) {
if (empty($file)) {
@thesoftwarejedi
thesoftwarejedi / clear-old-slack.py
Last active December 19, 2023 12:02
delete old slack files
import requests
import json
import calendar
from datetime import datetime, timedelta
#token from https://api.slack.com/web
_token = "YOUR TOKEN HERE"
_domain = "YOUR SUB DOMAIN HERE"
if __name__ == '__main__':
@ramosmerino
ramosmerino / SAMODbmigrateController.php
Last active January 30, 2017 06:32 — forked from bruceoutdoors/DbmigrateController.php
The same ol' DbmigrateController, on steroids, for Laravel 5, and with some tweaks that I find useful for my work. In brief, get migration files by a created database, one for each table or all in one, ordered in creation time by their foreign keys, to only call the 'php artisan migrate'. Simply sugar.
<?php namespace App\Http\Controllers;
use \Illuminate\Support\Facades\DB;
use \Illuminate\Support\Str;
use League\Flysystem\Exception;
/**
* Class SAMODbmigrateController
*
* Converts an existing MySQL database to migrations files for Laravel 5.
@pringlized
pringlized / DbmigrateController.php
Last active August 29, 2015 14:15 — forked from bruceoutdoors/DbmigrateController.php
MySQL database script for full schema migrations in Laravel 5. Unlike the gist this was forked from, this script will write out each table to an individual file.
<?php namespace App\Http\Controllers;
/* * **
*
* MySQL database script for full schema migrations in Laravel 5.
*
* 1. Place this file inside app/Http/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@joshlewis
joshlewis / light-through-the-veins.ck
Last active September 4, 2023 16:37
This ChucK program will play the loop heard in Jon Hopkins's song Light Through the Veins (hear it at https://www.youtube.com/results?search_query=light+through+the+veins+jon+hopkins )
//Notes in loop
392.00 => float G4;
440 => float A4;
466.16 => float Asharp4;
523.25 => float C5;
587.33 => float D5;
659.25 => float E5;
698.46 => float F5;
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@curiouslychase
curiouslychase / post-receive.sh
Last active July 6, 2016 18:23
The post-receive hook that I use for deploying my Wordpress theme on a `git push`.
#!/bin/sh
LOGFILE=./post-receive.log
DEPLOYDIR=$DEPLOYDIR # The place to deploy to.
echo -e "[log] Received push request at $( date +%F)" >> $LOGFILE
echo "[log] - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
echo "[log] Starting Deploy..." >> $LOGFILE
@isimmons
isimmons / gist:8202227
Last active March 15, 2024 10:47
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');
@barryvdh
barryvdh / _ide_helper.php
Last active April 4, 2024 09:11
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");