Skip to content

Instantly share code, notes, and snippets.

View woganmay's full-sized avatar

Wogan May woganmay

View GitHub Profile
@woganmay
woganmay / hook.sh
Created June 25, 2020 08:48
Cache node_modules between envoyer.io deploys
#
# Use cached node_modules for faster frontend compile times
# on envoyer.io
#
# Rationale: If you don't want to set up node_modules caching on
# every server you deploy to, this drop-in deployment hook serves
# a similar purpose. It will symlink every new release to a shared
# node_modules folder, cutting out the installation time.
#
@woganmay
woganmay / bitbucket-pipelines.yml
Created September 11, 2019 20:41
Bitbucket CI Pipeline - Deploy Laravel Vapor
# Prerequisites:
# 1. Have the laravel/vapor-cli dependency in your project, so that composer install catches it
# 2. Set the VAPOR_API_TOKEN environment variable to your Vapor API key
# Details in the documentation: https://docs.vapor.build/1.0/projects/deployments.html#deploying-from-ci
# This pipeline will build a PHP 7.2 environment with dependencies, run the standard
# phpunit tests, then deploy to the staging environment on Vapor.
image: php:7.2.22-alpine
@woganmay
woganmay / Harvest.gs
Created August 24, 2019 17:22
Read Harvest timesheet data into a Google Sheet
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Integrations')
.addItem('Fetch Harvest', 'fetchHarvestData')
.addToUi();
}
function fetchHarvestData() {
// Update monthly, or read from another sheet
@woganmay
woganmay / api.php
Created June 12, 2019 01:21
Detect new versions of app.js automatically
<?php
// Ugly as sin, but gets the latest version URL for the app.js file
// The Vue app will query this every 60 seconds
Route::get('/version', function(){
$manifest = file_get_contents(public_path('mix-manifest.json'));
$manifest = json_decode($manifest);
return response()->json([
'latest' => $manifest->{'/js/app.js'}
]);
@woganmay
woganmay / auto-project-manager.gs
Created September 7, 2018 09:40
Pull Toggl entries through the Reports API, into an incremental Sheet tab.
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('My Business')
.addItem('Refresh Timesheets', 'getTimesheets')
.addToUi();
}
function getTimesheets() {
// Read API token and Workspace ID from Configuration tab
@woganmay
woganmay / page.php
Created November 5, 2017 12:33
Simple HTTP POST request from an OctoberCMS form submission
<?php
function onStart()
{
$flow = curl_init("https://prod-22.westeurope.logic.azure.com:443/...");
curl_setopt($flow, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($flow, CURLOPT_POST, TRUE);
curl_setopt($flow, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
@woganmay
woganmay / PixelController.php
Created October 2, 2017 19:38
Manage a tracking pixel
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use Illuminate\Http\Request;
use App\Jobs\SendOpened;
class PixelController extends Controller
@woganmay
woganmay / gist:de9bf6da8d23117e3f932c546f0581ae
Last active March 6, 2021 18:20
Setting up nginx + rtmp

This was all done on a Debian Linux server.

Speedtest

Install speedtest-cli by:

sudo easy_install speedtest-cli

That gives you a one-line command to run up/down tests via speedtest.net. To hit a specific server, check the main list at https://www.speedtest.net/speedtest-servers.php and provide the ID to test against:

@woganmay
woganmay / script.js
Last active February 2, 2018 22:05
Gscript for Sheets - get crypto tickers and maintain a history
// Sample workbook here:
// https://docs.google.com/spreadsheets/d/1DPASIiKJw6x0n2eq7t4xRU_FQsizBH8Z8rXOfVk2Kb4/pubhtml
// Main function - does everything
// Triggered by Google every 15 minutes
function getAllTickers() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Crypto");
// Get all tickers
@woganmay
woganmay / bloop.js
Created May 14, 2017 20:20 — forked from jlongster/bloop.js
bloop
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}