Skip to content

Instantly share code, notes, and snippets.

View garrypolley's full-sized avatar
💭
Code and Stuff

Garry Polley garrypolley

💭
Code and Stuff
View GitHub Profile
@garrypolley
garrypolley / kafka_consume.md
Last active October 9, 2020 14:04
Ideas on how to consume Kafka Data

Consumption options

There are a few ways we can consume the data generated within our Kafka architecture. I want our API side consumers to do minimal work to consume topics. With that in mind there are a few ways we can get data out of topics and into our APIs that feed our Apps. API in this case is referring to the Backend For Frontend (BFF). There are 3 ways I think these patters can work.

  1. Direct from Kafka Topics
  2. From a shared consolidated store built off the topics
  3. Consumers that work via webhooks -- off of topics
@garrypolley
garrypolley / BigNum.java
Created September 27, 2017 19:43
A test of using BigNum and Floats. Conclusion: when you store a float in the database it seems to be about the same if you are careful about how you use the floats.
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.Scanner;
import java.lang.Float;
class BigNum {
public static void main(String[] args) {
System.out.println("Hi");
BigDecimal jim = new BigDecimal("3.2");
@garrypolley
garrypolley / determine_house.py
Last active November 13, 2016 16:23
Determines who gets what house
import random
people_playing = ['Garry', 'Joanna', 'Sara', 'Mark', 'Phil', 'Tom']
families = ['Stark', 'Greyjoy', 'Dorne', 'Tyrell', 'Lannister', 'Baratheon']
chosen_families = {}
for person in people_playing:
import turtle
def draw_multi_color_shape(t_turtle, size):
"""Make turtle t_turtle draw a multi-colour shape based on size passed in."""
colors = ['#2424FF', '#aaa', '#FF2424', '#ccc', '#24FF24', '#000']
for color in colors:
t_turtle.color(color)

Keybase proof

I hereby claim:

  • I am garrypolley on github.
  • I am garrypolley (https://keybase.io/garrypolley) on keybase.
  • I have a public key whose fingerprint is 97BA F5CD 14DE 4F3F E018 26E8 79CF 3F5A E11E 4494

To claim this, I am signing this object:

@garrypolley
garrypolley / example.md
Last active April 9, 2017 20:37
Example of a "bulk" update to a collection using JSON API Patch extension http://jsonapi.org/extensions/jsonpatch/

Below is an example request that updates all cards that are playing cards without a sleeve to have an attribute of mayGetDirty as true.

HTTP PATCH https://api.example.com/cards?type=Playing&hasSleeve=False

BODY
 [
    {
 "op": "replace",
@garrypolley
garrypolley / notes.md
Created December 2, 2015 15:42
Notes On Gitlab

My Notes on Gitlab

We've had Gitlab avaiable for a decent period of time on our team. I've looked at it now and again. Below are my thoughts on it thus far.

Likes

  • Viewing single pages of code is nice. I can have it styled like my sublime text editor.
  • Self hosted, so I do not have to worry about leaking bad commits to the public
  • Merge request is a more accurate name for the review
@garrypolley
garrypolley / sample.html
Created November 18, 2015 22:03
Simple file upload for Angular
<upload-file upload-url="http://google.com/">
</upload-file>
@garrypolley
garrypolley / tricks.md
Last active August 28, 2015 15:41
Useful sublime tricks

Below are some tricks for sublime text that make it easier and/or cool to work with.

"Zoom" in only one pane

This was a question I posed out to [stack overflow][zoom-in-pane] and it got a great answer.

  1. ctlr + `
    
@garrypolley
garrypolley / default.js
Last active August 29, 2015 14:28
default way to make a JavaScript module
(function (global) {
var MODULE_NAME = 'some_name',
moduleObject = {};
/* MODULE CODE GOES HERE
Don't forget to set the attributes of the module on the
`moduleObject`
*/