Skip to content

Instantly share code, notes, and snippets.

Pete Nicholls Aupajo

Block or report user

Report or block Aupajo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View -
[7a184b26-829b-495d-9e5c-b3017321c8d3 28/8065] Giving up after 5 attempts
[480f4644-c203-455b-9c8f-65bc0b8d2cb5 29/8065] Giving up after 5 attempts
[d7557738-a6c1-46f6-b20d-301458d3f80e 140/8065] Giving up after 5 attempts
[d30fac1c-5ef6-40fd-ab48-7eeb7480ff3d 141/8065] Giving up after 5 attempts
[32640d50-702b-4eb0-ae9f-a86615b990cf 143/8065] Giving up after 5 attempts
[0e24188c-6121-4fd5-91e3-45a738d8dbbe 147/8065] Giving up after 5 attempts
[ac1948ce-2469-4490-8bb7-f37f0607165c 151/8065] Giving up after 5 attempts
[990fe96f-b21b-491b-9d77-cf5d695a0c0b 152/8065] Giving up after 5 attempts
[f85cf5b4-5aee-4c6a-83b6-577eceeea9de 153/8065] Giving up after 5 attempts
[7e0f77d7-754e-4f92-a2c1-ecdaf512114a 200/8065] Giving up after 5 attempts
@Aupajo
Aupajo / client.rb
Last active Oct 11, 2017
Rack timings
View client.rb
require 'socket'
socket = TCPSocket.open('localhost', 9292)
puts "Sending headers at #{Time.now.strftime('%T.%L')}"
socket.puts <<~REQUEST
POST / HTTP/1.1\r
Host: localhost:9292\r
Accept: */*\r
View pancake_constraints.sql
CREATE TABLE pancakes (
/* The order number may be NULL - the kitchen has to eat, too! */
order_number integer UNIQUE,
/* Gotta have syrup */
maple_syrup_brand text NOT NULL,
/* Require order number and maple syrup to be unique */
CONSTRAINT order_syrup UNIQUE (order_number, maple_syrup_brand)
);
View README.md

box-text

Install with:

curl https://gist.githubusercontent.com/Aupajo/523845154c905355bb008646bc066f18/raw/a4d191aad9f189fbc76111f9c4ee08c3b9e08f35/box-text > /usr/local/bin/box-text && \
chmod u+x /usr/local/bin/box-text

Usage:

View a-better-git-branch.md

A better git branch

I'll often use branches to try out experiments, ideas, and to separate different trains of thought. Not every branch gets merged – in fact, it's quite common for me to make several commits on a branch, look at the end result, and throw the branch away without ever merging it (branching is cheap and ideas are cheap, but bad code is expensive). As a result, I can end up with a lot of branches. This makes the output of git branch difficult to sort through:

$ git branch
* account-org-association
  acdx-blog-posts
  add-static-resource-support
  alter-component-naming
View the-story-of-npm-and-yarn.md

The Story of NPM and Yarn

In the beginning there was NPM, and for a time it was good. Packages went forth and multiplied. The New Gods proclaimed the great demon Dependency Management had been slain. But The Old Gods knew better, for they had seen much and knew that the demon can never be killed, only held at bay.

The Old Gods were ignored. In the folly of a young age grew an abundance of packages and with them grew the scourge of dependency. In the depths beneath the earth, in a place beyond memory, the great demon stirred.

The first sign something was wrong was non-deterministic package version mismatches. “This is fine!” The New Gods declared. “A temporary setback, nothing more! We can fix it.” And so they introduced shrinkwrap, a lamp to combat the growing darkness.

But it proved to be too little, too late, and dusk continued to fall. The New Gods suffered their first major defeat at the [Battle of Left-pad](https://www.theregister.co.uk/2016/03/23/npm_left_

View buffered_json_array.rb
class BufferedJsonArray
ClosedError = Class.new(StandardError)
def initialize(target_buffer)
@target_buffer = target_buffer
@internal_buffer = "["
@closed = false
@first_entry = true
end
@Aupajo
Aupajo / config.ru
Last active Mar 15, 2017
ITTT trigger responder
View config.ru
require_relative 'environment'
app = Server.new do
trigger :turn_on_lightbulb do
# Make an API request...
Net::HTTP.post_form(URI('http://lightbulb.local'), 'status' => 'on')
# Response (any JSON-like data)
{ light_bulb: "on" }
end
@Aupajo
Aupajo / standard-metadata-retrieval.md
Last active Jan 29, 2017
A list of standard metadata retrieved by Test Pilot
View standard-metadata-retrieval.md

The following metadata types are currently being retrieved:

  • Account (Object)
  • AnalyticSnapshot
  • ApexClass
  • ApexComponent
  • ApexPage
  • ApexTrigger
  • ApprovalProcess
  • AssignmentRules
View bnz.md

Problem

You have been asked for your last three months' bank statements. Easy enough, right? Except your stupid engineer brain thought it would be a good idea to sign up to BNZ's YouMoney and divide your finances into neat boxes helpfully labeled “Rent”, “Power”, “Whisky”, and so on. Now you have 29 bank accounts, and you need to download 87 different statements.

This is somewhat vexing. The process will take Some Time. So your stupid engineer brain comes up with a new idea (hint: more technology is always the answer) - maybe you can automate this!

You estimate this task will take about an hour or so to do, and maybe about an half an hour to automate.

You consult the chart for good measure.

You can’t perform that action at this time.