Skip to content

Instantly share code, notes, and snippets.

@mmcev106
mmcev106 / deploy.sh
Last active August 29, 2015 14:14
A basic deploy script that uses two git repo clones and symlinks to deploy with zero downtime.
#!/bin/bash
set -e # Fail on non-zero exit code
set -u # Fail on undefined variables
deploymentDir=$1
symlink=$2
dirA=$3
dirB=$4
branchName=$5
@mmcev106
mmcev106 / simple-profiler.php
Created December 8, 2016 04:30
Dead simple PHP profiling
function simpleProfiler($name = null){
global $timepointFirstTime, $timepointLastTime, $timepointLastNumber;
if(!isset($timepointLastNumber)){
$timepointLastNumber = 0;
}
$newTime = microtime(true);
if(isset($timepointLastTime)){
echo number_format($newTime - $timepointLastTime, 5) . '<br>';
const int BUTTON = 2;
const int LED = 3;
const int BLINK_ON_INCREMENT = 50;
const int BLINK_PAUSE_INCREMENT = 75;
const int RING_TIME = 5000;
void setup() {
pinMode(BUTTON, INPUT_PULLUP);
pinMode(LED, OUTPUT);
@mmcev106
mmcev106 / change-wordpress-url-in-database.php
Last active July 17, 2023 20:28
change-wordpress-url-in-database
#!/usr/bin/env php
<?php
// TODO - Add support for multisite
// Could start by just throwing an error when a multisite install is detected.
// TODO - Add support for urls inside serialized objects.
// This may be very easily to do by including PHP's serialized string
// syntax (including the length) in the list of strings to replace.
/.idea
@mmcev106
mmcev106 / example.html
Last active June 24, 2018 00:33
API, jQuery, and Charts.js Example for Jeb
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js" integrity="sha256-CfcERD4Ov4+lKbWbYqXD6aFM9M51gN4GUEtDhkWABMo=" crossorigin="anonymous"></script>
<canvas id="myChart"></canvas>
<script>
$.get(
'https://httpbin.org/json',
{
@mmcev106
mmcev106 / migrecover-zone-file-cleanup.php
Created July 11, 2018 19:06
Cleans up the zone files and subdirectories from migrecover output so it matches the original file/folder structure backed up by Windows Easy Transfer.
<?php
$dir = '/home/mceverm/Downloads/mceverm/';
$it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if($file->getBasename() == '$Zone.Identifier$$DATA'){
$zoneFilePath = $file->getRealPath();
$dir = dirname($zoneFilePath);
<style>
body{
margin: 0px;
}
canvas{
width: 100vw;
height: 100vh;
}
</style>
@mmcev106
mmcev106 / v8.md
Created May 18, 2021 15:41
REDCap External Module Framework Proposed v8 Documentation

Framework Version 8

See the Framework Intro page for more details on framework versions in general.

Breaking Changes

  • A valid redcap_csrf_token parameter is now required on almost all POST requests, but will be automatically added behind the scenes in many cases.
    • Many module pages where the REDCap headers are included will not require any changes because the redcap_csrf_token parameter will automatically be added to static forms and jQuery post() method calls.
    • The redcap_csrf_token POST parameter will need to be added to dynamically generated forms, jQuery ajax() calls, non-jQuery javascript requests, and POST requests on pages where the REDCap headers are not included. In those cases, the $module->getCSRFToken() method should be used to set the value of the redcap_csrf_token POST parameter. All POST requests made by module code should be tested before releasing a module update for this framework version.
  • For the very small number of pages where CSRF tokens
// ==UserScript==
// @name Spotify - Random Buttons
// @namespace spotify-random-buttons
// @version 0.1
// @description Add missing randomize features to Spotify.
// @author Mark McEver
// @match https://open.spotify.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=spotify.com
// @grant none
// ==/UserScript==