Skip to content

Instantly share code, notes, and snippets.

View mikesprague's full-sized avatar

Michael Sprague mikesprague

View GitHub Profile
<?php
// define the path and name of cached file
$cachefile = 'cached-files/'.date('M-d-Y').'.php';
// define how long we want to keep the file in seconds. I set mine to 5 hours.
$cachetime = 18000;
// Check if the cached file is still fresh. If it is, serve it up and exit.
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);
exit;
}
@mikesprague
mikesprague / fcc-chrome-dark-user-style.css
Last active July 15, 2020 18:52
Dark/night user style for Free Code Camp in Chrome (WIP)
body {
background: #222 !important;
color: #969696;
}
code {
padding: 2px 4px !important;
}
a:hover {
color: #999;
}
@mikesprague
mikesprague / data-tables-server-side-example.cfm
Last active May 5, 2020 14:34
CFML: DataTables server-side code example from website
<cfscript>
/*
Script: DataTables server-side script for ColdFusion (short script style) and MySQL
License: GPL v2 or BSD (3-point)
ReWrite: 12/12/2011 John Fournier
Notes: Adobe ColdFusion 9 + limited inline documentation used, see other long examples for explanation
*/
datasource = 'jQueryDTable'; // set to your ColdFusion database
sTable = 'ajax'; // your table
aColumns = ['engine','browser','platform','version','grade']; // your columns
*, html, html *, body, body * {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
text-rendering: geometricPrecision !important;
}
body {
word-spacing: -1px;
-webkit-font-smoothing: auto;
}
@mikesprague
mikesprague / full-width.css
Created August 11, 2016 07:26
Full width container in limited width parent (credit: https://css-tricks.com/full-width-containers-limited-width-parents/)
.full-width {
width: 100vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
@mikesprague
mikesprague / index.html
Created September 16, 2018 11:47
JS to lighten, darken, or blend colors (credit to/original author: https://glitch.com/@notwaldorf)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Color gradient</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,700" rel="stylesheet">
<link rel="stylesheet" href="/style.css">
<script src="/script.js" defer></script>
@mikesprague
mikesprague / rollbar_deploy_notification.sh
Created September 3, 2018 20:46
Rollbar deploy notification (replace access token and rollbar user with your own values)
#!/bin/bash
ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ENVIRONMENT=production
REVISION=`git log -n 1 --pretty=format:"%H"`
COMMENT=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g'`
ROLLBAR_USER=xxxxxxxxxx
curl https://api.rollbar.com/api/1/deploy/ \
-F access_token=$ACCESS_TOKEN \
@mikesprague
mikesprague / localweather.io-20180819T153541.json
Created August 19, 2018 19:42
localweather.io - Google Lighthouse Audits - August 19, 2018 15:35
{
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.42 Safari/537.36",
"lighthouseVersion": "3.0.3",
"fetchTime": "2018-08-19T19:35:41.503Z",
"requestedUrl": "https://localweather.io/",
"finalUrl": "https://localweather.io/",
"runWarnings": [],
"audits": {
"is-on-https": {
"id": "is-on-https",
@mikesprague
mikesprague / install-docker-on-raspberry-pi.sh
Created March 18, 2018 13:10
Install and configure Docker for the Raspberry Pi
# get/start the offical docker installer
curl -sSL https://get.docker.com | sh
# set docker to auto-start
sudo systemctl enable docker
# start the docker daemon
sudo systemctl start docker
# enable docker client
@mikesprague
mikesprague / slack-dark.css
Created February 19, 2018 23:53
My dark Slack theme
html {
background: #404552 !important;
}
body {
background: #404552;
color: #d3dae3;
}
a {