Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Aupajo's full-sized avatar

Pete Nicholls Aupajo

  • Christchurch, New Zealand
View GitHub Profile
@Aupajo
Aupajo / standard-metadata-retrieval.md
Last active January 29, 2017 21:33
A list of standard metadata retrieved by Test Pilot

The following metadata types are currently being retrieved:

  • Account (Object)
  • AnalyticSnapshot
  • ApexClass
  • ApexComponent
  • ApexPage
  • ApexTrigger
  • ApprovalProcess
  • AssignmentRules
@Aupajo
Aupajo / bnz.md
Last active December 7, 2016 00:29

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.

@Aupajo
Aupajo / response.json
Last active April 28, 2016 09:08
PB & JSON
{
"minimumAppVersions": {
"iOS": "1.0.0"
},
"stores": [
{
"name": "Punky Brewster",
"location": {
"latitude": -43.5368540539132,
"longitude": 172.608717675136
@Aupajo
Aupajo / gist:5a9eebed339a22a5418aaae742ffd67c
Created April 26, 2016 02:15
NewRelic Memory Profiler shortcut
NewRelic::Agent::Samplers::MemorySampler.new.sampler.get_sample
@Aupajo
Aupajo / 01.1.lifecycle.rb
Last active August 25, 2023 19:26
Sockets in Ruby
require 'socket'
# 1. Create
# AF_INET means IPv4 (xxx.xxx.xxx.xxx)
# SOCK_STREAM means communicating with a stream (TCP)
#
# Can be simplified to symbols :INET and :STREAM, respectively
server = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM)
@Aupajo
Aupajo / proof-of-concept.html.erb
Created March 2, 2016 18:29
Uploading to S3 without a server in Rails
<% post = Aws::S3::Bucket.new(ENV.fetch('AWS_S3_BUCKET')).presigned_post(key: 'uploads/${filename}', acl: 'public-read') %>
<%= form_tag(post.url, id: 'uploader', multipart: true, authenticity_token: false, enforce_utf8: false) do %>
<% post.fields.each do |name, value| %>
<%= text_field_tag name, value %>
<% end %>
<% # Must be last field %>
<%= file_field_tag :file %>
@Aupajo
Aupajo / brewbot.md
Last active December 14, 2016 06:19
@Aupajo
Aupajo / recent-items-bug.md
Last active October 20, 2015 00:55
Salesforce Recent Items bug

Steps to reproduce

  1. Build up a Recent Items history by visiting different objects (Contacts, Cases, etc.)
  2. Create at least 10 objects during a test run (see example code below)
  3. Initiate a test run
  4. Wait for test run to finish
  5. Visit the Home tab

Expected: Recent Items remains unchanged

class Person
attr_reader :attributes, :original_attributes
def initialize(original = {})
@original_attributes = original
@attributes = original.clone
end
def sandwich=(value)
attributes[:sandwich] = value
pi@raspberrypi /sys/bus/w1/devices/28-000005305b33 $ cat w1_slave
01 01 4b 46 7f ff 0f 10 e3 : crc=e3 YES
01 01 4b 46 7f ff 0f 10 e3 t=16062