Skip to content

Instantly share code, notes, and snippets.

View sgraessle's full-sized avatar

Scott Graessle sgraessle

  • Zynga
  • Austin, Texas
View GitHub Profile
@sgraessle
sgraessle / gist:8d7d1395ce171e74e8b35cd08c0a61f0
Created September 12, 2016 20:05
terraform debug output after iam module configuration
* aws_lambda_function.heartbeat: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.
Please include the following information in your report:
Terraform Version: 0.7.3
Resource ID: aws_lambda_function.heartbeat
Mismatch reason: attribute mismatch: role
Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"role":*terraform.ResourceAttrDiff{Old:"arn:aws:iam::413359656938:role/exp_cf_lambda_dynamodb_datafull", New:"${module.iam.lambda_function_role_id}", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyTainted:false}
Diff Two (usually from apply): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff(nil), Destroy:false, DestroyTainted:false}
@sgraessle
sgraessle / resize.sh
Last active February 15, 2024 05:41
Generate multiple image sizes from a directory tree.
#!/bin/bash
if [ $# -ne 2 ]
then
echo usage: $(basename $0) source_path dest_path
exit
fi
path=$2/$(dirname $1)
mkdir -p $path
@sgraessle
sgraessle / gradientShader.fsh
Created April 9, 2015 21:40
Dumb 5-point gradient OpenGL shader.
void main() {
// Set the output color to red.
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
vec2 texCoord = cc_FragTexCoord1;
float l0 = 0.2, l1 = 0.1, l2 = 0.0, l3 = 0.1, l4 = 0.2;
float y0 = 1.0, y1 = 0.85, y2 = 0.5, y3 = 0.15, y4 = 0.0;
float level = 0.2;
@sgraessle
sgraessle / gist:8968064
Created February 13, 2014 01:29
Sample match data
[
{
"match_id":"19722606-366e-46af-b957-824347ec2caa",
"status":"ended",
"participants":[
{
"player_id":"G:1885232197",
"status":"done",
"last_turn_date":"2014-02-05T17:33:18Z",
"match_outcome":"won"
@sgraessle
sgraessle / gist:8968031
Created February 13, 2014 01:26
This comparison code seems correct, but resulting matches object remains unsorted.
GameCenterTurnBasedManager.loadMatchesDidFinishEvent += (List<GKTurnBasedMatch> matches) => {
Logger.Log ("loadMatchesDidFinish: " + Json.GetJsonString(matches));
matches.Sort((x, y) => {
if (x.currentParticipant != null && x.currentParticipant.playerId == GameCenterBinding.playerIdentifier()) return -1;
else if (y.currentParticipant != null && y.currentParticipant.playerId == GameCenterBinding.playerIdentifier()) return 1;
else if (x.status == y.status) return -x.creationDate.CompareTo(y.creationDate);
else if (x.status == GKTurnBasedMatchStatus.Ended) return 1;
else if (y.status == GKTurnBasedMatchStatus.Ended) return -1;
else if (x.status == GKTurnBasedMatchStatus.Matching) return -1;
else if (y.status == GKTurnBasedMatchStatus.Matching) return 1;
@sgraessle
sgraessle / gist:8029700
Last active December 31, 2015 18:49
Here's the relevant code for our text-to-mobile form. We're using a jQuery plugin for the country-code drop down: http://jackocnr.com/intl-tel-input.html, then stripping extraneous punctuation and leading zeroes from the result.
<html>
<head>
<meta charset="utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="../js/intlTelInput.min.js"></script>
<link rel="stylesheet" href="../css/intlTelInput.css">
</head>
<style>
.f16 .flag {background-image: url('../images/canvas/flags16.png');}
</style>