Skip to content

Instantly share code, notes, and snippets.

<div style="page-break-inside:avoid;page-break-after:always"></div>
@anthonycoffey
anthonycoffey / my-windows-terminal-config.json
Last active August 19, 2019 07:12
My Windows Terminal Config
{
"globals" :
{
"alwaysShowTabs" : true,
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
"command" : "closeTab",
@anthonycoffey
anthonycoffey / jetbrains-regex-match-all-log-statements
Last active July 21, 2019 09:19
Match all console.log() statements in a project with JetBrains RegEx
console.log\((.+)\);\n # this will match most console.log(); statements, unless they contain brackets or operators
@anthonycoffey
anthonycoffey / upload-base64-image-file.php
Last active June 30, 2019 23:28
Upload Base64 Image with PHP
$base64_img = $_POST['img'];
$split = explode(',', substr($base64_img, 5), 2);
$mime = $split[0];
$img_data = $split[1];
$mime_split_without_base64 = explode(';', $mime, 2);
$mime_split = explode('/', $mime_split_without_base64[0], 2);
if (count($mime_split) == 2) {
// get file extension
$extension = $mime_split[1];
@anthonycoffey
anthonycoffey / highcharts-export-module-implementation.js
Last active June 11, 2019 09:07
Implementation of Custom Highcharts Export Module
const express = require('express');
const router = express.Router();
const exportCharts = require('./modules/export-charts.js'); // this is my export module
router.post('/mbd', async function(req,res){
exportCharts.initPool();
const chartOptions = req.body;
@anthonycoffey
anthonycoffey / export-module-first-attempt.js
Last active June 11, 2019 20:19
First iteration of custom Highcharts export module
const exporter = require('highcharts-export-server');
exports.module = function(exportSettings){
return new Promise((resolve, reject) => {
exporter.initPool()
exporter.export(exportSettings, function(err, res){
if(err){
console.log(err)
return reject(err)
@anthonycoffey
anthonycoffey / highcharts-export-server-node.js
Last active June 11, 2019 09:47
Highcharts Export Server Node Module
const exporter = require('highcharts-export-server');
const chartExport = {
initPool: function (){
exporter.initPool({ // experiment with different values here to optimize performance
maxWorkers: 10,
initialWorkers: 1,
workLimit: 25,
timeoutThreshold: 2000,
queueSize: 3,
@anthonycoffey
anthonycoffey / StripeCheckout.vue
Last active June 8, 2019 21:02
Stripe Checkout with Vue
<template>
<div>
<div v-if="!authenticating">
<v-layout
align-center
justify-center
>
<v-flex
xs12
sm8
@anthonycoffey
anthonycoffey / es6-computed-property-names.js
Last active June 1, 2019 19:46
ES6 Computed Property Names in Object Literals
var keys = {
name: 'name',
email: 'email',
password: 'password'
}
var obj = {
[`_${keys.name}`]: 'John Doe',
[`_${keys.email}`]: '[email protected]',
@anthonycoffey
anthonycoffey / sass-loading-component.vue
Last active May 9, 2019 05:50
Language attribute set to SCSS in Vue component
<template>
<div>
</div>
</template>
export default {
name: 'sass loading component',
}
</script>
<style lang="scss" scoped>
// we can write sass now, woohoo!