Skip to content

Instantly share code, notes, and snippets.

View richogreen's full-sized avatar

Richard Green richogreen

View GitHub Profile
@richogreen
richogreen / bitbucket-pipelines.yml
Created October 25, 2018 01:40
BitBucket Pipelines configuration for Create React App build and deployment to AWS S3 with CloudFront cache
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.4
pipelines:
default:
- step:
@richogreen
richogreen / gulpfile.js
Created May 23, 2018 01:38
Gulp setup for Drupal 8 (Acquia DevDesktop, SASS, ES6, Browser Sync)
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var cp = require('child_process');
/**
* Launch the Server
@richogreen
richogreen / index.js
Last active May 15, 2018 00:09
JavaScript - Find the smallest missing positive integer from an unsorted integer array
const test1 = [1, 2, 0] // Output: 3
const test2 = [3, 4, -1, 1] // Output: 2
const test3 = [7,8,9,11,12] // Output: 1
const firstMissingPositive = (inputArray) => {
// Re-order array lowest to highest (mutation OK)
inputArray.sort((a, b) => a - b)
// Remove negative numbers
const cleanArray = inputArray.filter((n) => n > 0)
@richogreen
richogreen / mc_subscribe.php
Last active June 20, 2016 04:52
MailChimp API v3 - Subscribe via cURL/PHP
<?php
/**
* @param $email
* @param $fname
* @param $apikey
* @param $listid
* @param $server - Datacenter associated with account e.g. 'us2'
*/
function mc_subscribe($email, $firstName, $apiKey, $listId, $server)