Skip to content

Instantly share code, notes, and snippets.

Timothy D forkfork

  • Sydney
Block or report user

Report or block forkfork

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
forkfork /
Created Jul 24, 2018
reordering content by country

What we have now:

  • The content page in admin is used to reorder all scheduled offers (regardless of which scheduled country)
test-le-svc-offer-syd::DATABASE=> \d offer_brand
                             Table "public.offer_brand"
         Column         |         Type          | Collation | Nullable |  Default   
 fk_offer_salesforce_id | character varying(18) |           | not null | 
forkfork /
Last active Mar 12, 2018
Lux Coding Test Node.js

Lux Group Coding Test

We would like you to create a simple Node.js express server which has a single route, /api/search?q=thailand (the thailand part is a variable).

The new route will request packages from "", and will return a filtered view of content - with the same structure, but filtering to just show the packages based on text-searching the .result[].name and .result[].location fields for the content in the "q" query param.

Please include:

  • a package.json (so we can get deps and run the project)
  • suitable test coverage
View gist:6846a0aaf25a94f1db9c7d666aec8fca
- S3 bucket proxy_pass
Plan A:
- Serve mobile config route from svc-discovery
- Continue to store 'main' state file in S3
- Add an 'index' state file which looks something like:
forkfork / ioredis_example.js
Last active Aug 27, 2019
Example of using Redis Streams with Javascript/ioredis
View ioredis_example.js
var Redis = require('ioredis');
var redis = new Redis({
host: "",
password: "7884b8baaa49fbcb48f17ad2a146"
async function main() {
// write an event to stream 'events', setting 'key1' to 'value1'
await redis.sendCommand(
forkfork /
Last active Dec 16, 2017
Getting Started - Event Streaming in 10 minutes

Getting Started - Event Streaming in 10 minutes

Wiftycloud instances allow you to manage a stream of events. Events might be customer behaviour such as registration, login, or purchasing.


Events are has the follow attributes:

  • An ID, a timestamp with deduplication - for example: 1511695734461-0. This is auto-generated by the server.

XADD streamname [MAXLEN items] * field value [field value ...]

Adds a set of fields with values to the specified stream. If MAXLEN items are exceeded, items are removed from the beginning of the stream to bring the length down to MAXLEN. The "*" field is to autogenerate an item ID, but can be overriden.

Return value

Simple string reply: epoch time (in milliseconds) followed by a .N (for differentiating multiple events on the same millisecond)

View test-coroutine.lua
local co
local fetch = function(url)
local promise =
promise["then"](promise, function(_, res)
local jsonPromise = res:json()
jsonPromise["then"](jsonPromise, function(_, json)
forkfork /
Last active May 3, 2019
Atomic Json modifications with Redis

Atomic Operations in Redis

Redis is a commonly used as a mini 'database' for caching, shared queues, and similar. It is generally fast & reliable for these tasks. Redis does not support nested data types, and misusing redis for this type of thing can end up with the situation described below.

Imagine that we want to store the following data in Redis:

set users '[{"user":"tim", "pages": ["aaa", "bbb"]}]'

You can’t perform that action at this time.