Skip to content

Instantly share code, notes, and snippets.

{
"name": "mmollick/github-team-repos",
"authors": [
{
"name": "Mike Mollick",
"email": "mollick2@gmail.com"
}
],
"require": {
"guzzlehttp/guzzle": "^7.0"
@mmollick
mmollick / DirectS3Upload.php
Created October 16, 2017 01:26
Class to generate V4 style signing keys for direct browser upload to S3 bucket
<?php namespace NeverBounce\Repositories;
use Carbon\Carbon;
class DirectS3Upload {
/**
* Supported regions
* @var array
*/
@mmollick
mmollick / xml2array.php
Last active May 17, 2017 19:38
Propper XML to Array
/**
* Creates an associative array from XML. XML elements with like named siblings
* become numeric indexed arrays. Attributes are not retained.
*
* Input XML:
* <Root>
* <RequestId>12345</RequestId>
* <Users>
* <User>
* <Name>Ted</Name>
@mmollick
mmollick / AccessControlList.js
Last active March 16, 2017 02:41
React Middleware Example
import React, {Component} from 'react';
import { connect } from 'react-redux';
/**
* AccessControlList middleware
* - gets permissions from redux
* - checks if user's role/permissions match permissions specified in route
* - displays unauthorized message if permissions don't match
*/
class AccessControlList extends Component {
@mmollick
mmollick / setup.sh
Created March 2, 2017 18:39 — forked from bradp/setup.sh
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@mmollick
mmollick / exampleSelection.md
Last active September 7, 2016 15:12
Extract javascript object components

Heres an example of what a match will look like

/**
     * Request timeout in milliseconds
     * After this threshold is reached the result is assumed unknown. This is likely
     * a trouble host that will take extra time to resolve.
     */
    timeout: {
 default: 30000,
@mmollick
mmollick / direct_input.php
Created June 21, 2016 13:43
Example of direct input
<?php
// Get file contents
$input = file_get_contents(__DIR__ . '/file.csv');
// Start job
$ch = curl_init('https://api.neverbounce.com/v3/bulk');
$data = [
"access_token" => $access_token,
"input" => $input,
"input_location" => 1,
<?php
ini_set('memory_limit', '1024M');
/**
* show a status bar in the console
*
* <code>
* for($x=1;$x<=100;$x++){
*
* show_status($x, 100);
@mmollick
mmollick / release.sh
Last active March 18, 2016 16:44
A bash script that builds and packages our application. It automatically commits and tags it enforcing semver
#!/bin/bash
printHelp () {
printf "This utility will create the proper release commit to be used for deployment\n"
printf "Options:\n"
printf " -v|--version Explicitly define the version number\n"
printf " -M|--major Bump the major version number\n"
printf " -m|--minor Bump the minor version number\n"
printf " -p|--patch Bump the patch version number\n"
printf " -r|--rebundle Forces Gulp & Webpack compilation\n"
@mmollick
mmollick / Single Verification Request
Last active February 9, 2016 15:49
NeverBounce Curl Example
curl -X POST https://api.neverbounce.com/v3/single\
-d access_token=<ACCESS TOKEN>\
-d email=<EMAIL>