Skip to content

Instantly share code, notes, and snippets.

View derak-kilgo's full-sized avatar

Derak Kilgo derak-kilgo

View GitHub Profile
@derak-kilgo
derak-kilgo / slack-night-mode-custom.css
Last active February 13, 2019 15:11 — forked from sandheepgr/slack-night-mode-custom.css
Night mode css file for slack
body { background: #404040; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #404040; }
@derak-kilgo
derak-kilgo / adhoc-profiler.php
Created February 12, 2019 21:13
A ad-hoc method profiler for locating slow code in a legacy environment without xdebug.
<?php
function stopwatch($key){
static $log;
static $tstart;
$returnVal = 0.0;
if(empty($log)){
$log = array();
}
@derak-kilgo
derak-kilgo / ssl-skip-peer-verify.php
Created July 10, 2018 20:56
A plugin for local dev to disable ssl peer verification on SSL sites.
/*
Plugin Name: Skip SSL Verify
Plugin URI: http://www.damiencarbery.com
Description: Skip SSL verify in curl downloads - fixes: Download failed. error:0D0890A1:asn1 encoding routines:func(137):reason(161).
Author: Damien Carbery
Version: 0.1
*/
function ssv_skip_ssl_verify($ssl_verify) {
return false;
@derak-kilgo
derak-kilgo / divi-disable-maps.php
Created July 10, 2018 20:36 — forked from lots0logs/child-functions.php
WordPress :: Divi Builder :: Disable Google Maps
<?php
/**
* @package Divi_Disable_Maps
* @version 1.0
*/
/*
Plugin Name: Divi Disable Maps
Description: Enable only if you are not using the map module. Fixes "Google Maps JavaScript API warning: NoApiKeys" wanring in the console.
Author: lots0logs
Author URI: https://gist.github.com/lots0logs/67d639070dc54505eef1
@derak-kilgo
derak-kilgo / wordpress-config-extract.php
Last active October 29, 2021 14:16
Extract database and other constants from a wp-config.php file without "including" it.
<?php
/**
* Extract key and value from all "define" constants in a wp-config.php file using built-in php tokenizer functions.
* Does not "include" the file so it won't pollute the current scope or cause side effects.
*
* NOTE: Works with constants defined as string, bool or number
* Method can extract values from statements like:
* define( 'DB_NAME', 'wordpress' );
* define('WP_DEBUG', true);
* define('SOMEINT', 1234567);
<?php
/**
* @author https://stackoverflow.com/users/308825/maerlyn
* Based off the one in Symfony's Jobeet tutorial.
*/
function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
@derak-kilgo
derak-kilgo / stranger_things.sketch
Created December 1, 2017 20:13
An arduino sketch for "stranger things" style message wall with ALITOVE WS2811 RGB LED Pixel Lights. http://a.co/bxTfwT6
//@see http://www.woodlandmanufacturing.com/articles/news/how-to-make-a-stranger-things-alphabet-sign-with-lights-code
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 50
#define DATA_PIN 5
#define BRIGHTNESS 255
// Define the array of leds
@derak-kilgo
derak-kilgo / gitolite-to-gogs.php
Last active August 10, 2017 22:18
A script to load gitolite's bare git repositories into gogs database.
#!/usr/bin/env php
<?php
/* A tool to import repos from gitolite to gogs (db version 17)
*
* Gogs and gitolite use bare repos when hosting your repositories.
* You can add repositories directly into the gogs-repo directory but gogs won't see
* them until they are also added to the database.
*
* This script adds entries into the repository, access, watch and team_repo tables.
@derak-kilgo
derak-kilgo / universal-student-view.js
Created June 6, 2017 20:36
Canvas Universal Student Button
/*
* Generate a universal "Student View" button.
* Modified to hide button on course edit screens to avoid conflicts with kennithware
* @see https://community.canvaslms.com/groups/canvas-developers/blog/2017/04/20/universal-student-view-button-for-teachers
*/
var universalStudentView = function() {
var isTeacher, isEdit, isCourse, courseId, templateButton, sutdentViewVisible, studentViewURL, getPath;
// Determine if the user is actually a teacher
@derak-kilgo
derak-kilgo / gist:84d5e16c93ebfab4df340f513a97209f
Created May 2, 2017 19:11 — forked from thiamteck/gist:2324779
MySql random word function based on Lorem Ipsum text
DROP FUNCTION IF EXISTS random_word;
CREATE FUNCTION random_word ()
RETURNS TEXT
RETURN (ELT( FLOOR(1 + (RAND() * (100-1))),
'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'Integer', 'nec',
'odio', 'Praesent', 'libero', 'Sed', 'cursus', 'ante', 'dapibus', 'diam', 'Sed', 'nisi',
'Nulla', 'quis', 'sem', 'at', 'nibh', 'elementum', 'imperdiet', 'Duis', 'sagittis', 'ipsum',
'Praesent', 'mauris', 'Fusce', 'nec', 'tellus', 'sed', 'augue', 'semper', 'porta', 'Mauris',
'massa', 'Vestibulum', 'lacinia', 'arcu', 'eget', 'nulla', 'Class', 'aptent', 'taciti', 'sociosqu',