Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew J. Clemente mjclemente

View GitHub Profile
@mjclemente
mjclemente / PrettyJSON.py
Created Apr 9, 2021 — forked from brokaw/PrettyJSON.py
A BBEdit text filter to prettify JSON.
View PrettyJSON.py
#!/usr/bin/env python3
# A text filter for BBEdit. If it encounters a JSON error, it writes an error
# message to stderr (appears in a new BBEdit window) and leaves the original
# text unaltered. c.f.
# http://crisp.tumblr.com/post/2574967567/json-pretty-print-formatting-in-bbedit
# c.f. http://blog.scottlowe.org/2013/11/11/making-json-output-more-readable-with-bbedit/
import json
import sys
@mjclemente
mjclemente / RetryProxy.cfc
Created Mar 4, 2021 — forked from bennadel/RetryProxy.cfc
Creating A Generic Proxy For Retry Semantics In ColdFusion
View RetryProxy.cfc
component
output = false
hint = "I provide automatic retry functionality around the target component."
{
/**
* I initialize the retry proxy with the given target component. Retries will
* only be applied to "transient" errors. And, since the proxy doesn't know which
* errors are transient / retriable, it must check with the isTransientError()
* function.
@mjclemente
mjclemente / fork forced sync
Created Feb 5, 2021 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
View fork forced sync
git remote add upstream https://github.com/some_user/some_repo
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
@mjclemente
mjclemente / app.e2e-spec.ts
Created Aug 4, 2020 — forked from firxworx/app.e2e-spec.ts
NestJS Integration/E2E Testing Example with TypeORM, Postgres, JWT
View app.e2e-spec.ts
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication, LoggerService } from '@nestjs/common'
import * as request from 'supertest'
import { AppModule } from './../src/app.module'
class TestLogger implements LoggerService {
log(message: string) {}
error(message: string, trace: string) {}
warn(message: string) {}
debug(message: string) {}
@mjclemente
mjclemente / 20190417131115_test-setup.ts
Created Jul 21, 2020 — forked from tukkajukka/20190417131115_test-setup.ts
Knex.js & TypeScript config example · How to setup Knex.js in a TypeScript project
View 20190417131115_test-setup.ts
import * as Knex from 'knex';
export async function up(knex: Knex): Promise<any> {
return knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
return knex.schema.dropTable('test_setup');
View SalesforceApiWrapper.cfc
component hint="wrapper for Salesforce REST 2.0 API" {
pageEncoding "utf-8";
/**
Copyright (C) 2012 Daniel Watt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
@mjclemente
mjclemente / date.cfc
Created Mar 7, 2020
Get File Creation Date with Java and ColdFusion
View date.cfc
// Sourced from https://stackoverflow.com/a/41191422
// Get file attributes using NIO
var nioPath = createObject("java", "java.nio.file.Paths").get( filePath, [] );
var nioAttributes = createObject("java", "java.nio.file.attribute.BasicFileAttributes");
var nioFiles = createObject("java", "java.nio.file.Files");
var fileAttr = nioFiles.readAttributes(nioPath, nioAttributes.getClass(), []);
writeDump( var='#parseDateTime(fileAttr.creationTime().toString())#', abort='true' );
@mjclemente
mjclemente / singleLine.cfm
Created Oct 10, 2019 — forked from JamoCA/singleLine.cfm
ColdFusion UDF to trim, strip multiple spaces and remove undesireable space characters (non-breaking space, tab, line feed, carriage return)
View singleLine.cfm
function singleLine(s){
s = replacelist(s, "#chr(9)#,#chr(10)#,#chr(12)#,#chr(13)#,#chr(160)#", " , , , , ");
return trim(reReplace(s, "[[:space:]]{2,}", " ", "all"));
}
@mjclemente
mjclemente / syntax.css
Last active Jun 27, 2019 — forked from edwardhotchkiss/syntax.css
Solarized Light Pygments CSS / Jekyll
View syntax.css
.highlight {
background-color: #efefef;
border: 1px solid #ddd;
-moz-box-shadow: 1px 1px rgba(0,0,0,0.1);
-webkit-box-shadow: 1px 1px rgba(0,0,0,0.1);
box-shadow: 1px 1px rgba(0,0,0,0.1);
overflow: hidden;
}
@mjclemente
mjclemente / create-docker-servers-doctl.sh
Last active Mar 19, 2021
Create Docker Hosts on DigitalOcean with doctl
View create-docker-servers-doctl.sh
#!/bin/bash
#For more details, see: https://blog.mattclemente.com/2019/03/04/script-docker-host-creation-digitalocean-doctl.html
DO_DROPLET_NAME=docker-node
DO_SIZE=s-1vcpu-1gb
DO_REGION=nyc1
DO_SSH_IDS=$(doctl compute ssh-key list --no-header --format ID)
DO_TAGS=demotag
DO_DROPLET_COUNT=3