Skip to content

Instantly share code, notes, and snippets.

View revsmoke's full-sized avatar

Reverend Smoke revsmoke

  • TPGArchitecture/Archinet
View GitHub Profile
@revsmoke
revsmoke / upload.cfc
Created August 3, 2021 16:29 — forked from dimsis/upload.cfc
ColdFusion 8 code for Plupload file uploading including chunked transfers
<!--- coldfusion 8 version --->
<cfcomponent>
<cffunction name="plupload" access="remote" returntype="struct" returnformat="json" output="false">
<cfargument name="name" default="" />
<cfscript>
var uploadDir = expandPath('../assets/');
var uploadFile = uploadDir & arguments.NAME;
var response = {result = arguments.NAME, id = 0};
var result = {};
@revsmoke
revsmoke / service-worker.js
Created August 13, 2020 15:24 — forked from JMPerez/service-worker.js
An example of a service worker for serving network first, cache second
// the cache version gets updated every time there is a new deployment
const CACHE_VERSION = 10;
const CURRENT_CACHE = `main-${CACHE_VERSION}`;
// these are the routes we are going to cache for offline support
const cacheFiles = ['/', '/about-me/', '/projects/', '/offline/'];
// on activation we clean up the previously registered service workers
self.addEventListener('activate', evt =>
evt.waitUntil(
@revsmoke
revsmoke / base62.cfc
Created April 23, 2020 04:48 — forked from ryanguill/base62.cfc
coldfusion component; allows you to encode an integer as a base62 string using [a-zA-Z0-9] - useful for url shortening. should handle from 0 to 9,223,372,036,854,775,807
component {
variables.ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
variables.BASE = bigInt(len(ALPHABET).toString());
private any function bigInt (required string input ){
return createObject("java", "java.math.BigInteger").init(input);
}
private any function stringBuilder (string input = "") {
@revsmoke
revsmoke / .htaccess
Created March 26, 2020 18:39 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@revsmoke
revsmoke / upload.cfc
Last active June 1, 2017 03:02 — forked from jsteenkamp/upload.cfc
ColdFusion code for Plupload file uploading including chunked transfers
<cfcomponent>
<cffunction name="upload" access="remote" returntype="struct" returnformat="json" output="false">
<cfscript>
// var uploadDir = expandPath('.') & '/uploads/'; // should be a temp directory that you clear periodically to flush orphaned files
var uploadDir = getTempDirectory();
var uploadFile = uploadDir & arguments.NAME;
var response = {'result' = arguments.NAME, 'id' = 0};
var result = {};
// if chunked append chunk number to filename for reassembly