Skip to content

Instantly share code, notes, and snippets.

View texdc's full-sized avatar
🕶️

George Cooksey texdc

🕶️
  • Nashville, TN
View GitHub Profile
import boto3
import copy
table = "${destTableName}"
def handler(event, context):
// do some assume role stuff into another account here
// client = boto3.client('iam')
// response = client.assume_role(
// RoleArn=arn,
// RoleSessionName=username,
// DurationSeconds=timeout
@texdc
texdc / hosted_zone_id.yml
Created October 6, 2017 21:06
Two ansible commands to get the Route53 zone id for a given DNS zone
---
- name: get hosted zone info
route53_facts:
query: hosted_zone
register: zone_info
- name: get zone id
set_fact:
zone_id: "{{ zone.Id | regex_replace('/hostedzone/', '') }}"
when: zone.Name == route53_zone + '.'
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@texdc
texdc / account.dart
Last active February 6, 2017 20:10
Assuming that Akka had a Dart SDK...
library ddd.account;
import 'account_event.dart';
import 'package:akka/akka.dart' show TypedActor;
class _AccountState {
static const String _UNKNOWN_ACCOUNT = 'unknown';
final String accountNumber;
@texdc
texdc / string.js
Last active December 27, 2016 18:29
utility ("sugar") properties and functions inspired by Dart and C#
if (String.prototype.isEmpty == undefined) {
Object.defineProperty(String.prototype, 'isEmpty', {
get: function() { return this.trim() == ''; }
});
}
if (String.prototype.isNotEmpty == undefined) {
Object.defineProperty(String.prototype, 'isNotEmpty', {
get: function() { return this.trim() != ''; }
});
@texdc
texdc / application.php
Last active February 3, 2017 01:29
Higher-Order application building
<?php declare(strict_types=1);
namespace proj\http;
interface ApplicationInterface {
public function run();
public function use(callable $aMiddleware);
public function respondTo(string $anHttpMethod, string $aUriPath, callable $aResponder);
<?php declare(strict_types=1);
/**
* @method static self AUTO()
* @method static self ASK()
* @method static self SCHEDULE()
* @method static self IGNORE()
*/
final class UpdateResponseType
{
@texdc
texdc / application.config.php
Last active September 15, 2017 18:31
A "better" ZF2 application config
<?php declare(strict_types=1);
namespace {owner}\{project}\environment;
final class ApplicationConfig
{
public const ENV_DEVELOPMENT = 'development';
public const ENV_TEST = 'test';
public const ENV_STAGING = 'staging';
public const ENV_PRODUCITON = 'production';
"use strict"
var Util = Object.create({}, {
isDefined: { value: function(aValue) {
return !this.isUndefined(aValue);
}},
isUndefined: { value: function(aValue) {
return (aValue === undefined);
}},
isA: { value: function(aValue, aType) {
<?php declare(strict_types=1);
class CallbackIterator implements Iterator
{
private $index = 0;
private $maxIterations = 0;
private $callback;
public function __construct(int $anIterationCount, callable $aCallback)
{