Skip to content

Instantly share code, notes, and snippets.

View maxwellimpact's full-sized avatar
😀
Making something awesome...

Jonathan Cox maxwellimpact

😀
Making something awesome...
View GitHub Profile
// Playground - noun: a place where people can play
import UIKit
import XCPlayground
class randomCirclesView: UIView {
override func drawRect(rect: CGRect) {
drawCircles()
import UIKit
// lame FizzBuzz test in swift
// 1
for x in 1...100 {
if x % 3 == 0 && x % 5 == 0 {
println("FizzBuzz")
} else if x % 3 == 0 {
@maxwellimpact
maxwellimpact / ExtendedMailServiceProvider.php
Created March 7, 2016 05:16
Sample service provider for extending Laravel's mail provider.
<?php
namespace App\Providers;
use Illuminate\Mail\MailServiceProvider;
class ExtendedMailServiceProvider extends MailServiceProvider
{
/**
* Extended register the Swift Transport instance.
@maxwellimpact
maxwellimpact / docker_container_custom_ip.rb
Created March 12, 2016 15:01
How to assign a specific IP to a Docker Container
#!sudo /usr/bin/env ruby
# -----------------------
# DOCKER IPS
#------------------------
# get the default docker info
system "eval $(docker-machine env)"
docker_ip = %x(docker-machine ip)
@maxwellimpact
maxwellimpact / docker_setup_hosts.rb
Created March 12, 2016 15:05
Dynamically add custom ip and domains to host file.
#!sudo /usr/bin/env ruby
# -----------------------
# HOSTS FILE
#------------------------
# get the ip from a param
container_ip = ARGV[0]
if !container_ip
@maxwellimpact
maxwellimpact / stripe_to_mailchimp_lambda.js
Last active March 22, 2016 17:23
Simple Lambda Node script for passing new Stripe customer to Mailchimp list
/**
* Stripe to Mailchimp passthrough
*
* 1. Setup a Lambda in AWS (128mb) with an API endpoint and paste in this script.
* 2. Add a map to the API for type application/json
* // we need this to add some BASIC security
* {
* "secret" : "$input.params('secret')",
* "body" : $input.json('$')
* }
@maxwellimpact
maxwellimpact / how_to_local_domains_w_docker.md
Last active March 3, 2022 04:55
A simple how to guide on using local domains with Docker for Mac beta

Using local development domains with Docker for Mac Beta

Caveats

This technique is only suitable for Docker for Mac Beta. This requires the use of pfctl to add ip/port forwarding and the /etc/hosts file to setup the domain, and both of which require sudo to run. This technique is required due to the fact that Docker only makes the containers accessible locally through the use of localhost and a random port. There reasoning beyond this has to do with Apple application sandboxing, but obviously is not ideal for most developers. Lastly, this will likely not work after a reboot so you will need to rerun the pfctl command. If you have several domains to worry about I'd suggest you setup a startup script in ruby or python to rerun the commands each time.

Please proceed with caution I'm not an expert on pfctl, though I don't foresee any major issues here. If anyone has a better way of doing this please share it and I'll update this document.

How To

Below are a set of steps required to forward an ip

@maxwellimpact
maxwellimpact / parallel-process.php
Created April 9, 2018 16:42
A simple scratch script for testing parallel processes in PHP.
<?php
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Process\Process;
require_once __DIR__ . '/../../vendor/autoload.php';
/*
* Playing with using only Process to handle parallel processes
* but still enabling each to stream their content at the same time.
@maxwellimpact
maxwellimpact / ApiResponsable.php
Created January 13, 2019 16:31
Simple helper for standard rest API Responses
<?php
use Illuminate\Http\Response;
trait ApiResponsable
{
protected function view($data = [])
{
return response()->json($data);
}
<?php
class TinkerwellController {
public function index() {
// TODO: Get this app name to show up on our page
// HINT: https://laravel.com/docs/7.x/views#creating-views
$appName = "PHP 101";
return view('__tinker__::tinkerwell');
}