Skip to content

Instantly share code, notes, and snippets.

View job2.md

Full Stack Javascript Developer (node.js, react)

Here at Luxury Escapes, our mission is to delight our customers with incredible deals for the world's best holidays.

You'll be joining one of our several small, cross-functional teams. You'll be working across the full stack, though we're also open to someone with more of a backend or frontend focus.

We're small-a agile, so we have daily stand ups, pretty autonomous teams, and devs deploy to prod many times every day. We have a flat, collaborative structure both within and between teams.

Relevant skills:

@forkfork
forkfork / reorder_content.md
Created Jul 24, 2018
reordering content by country
View reorder_content.md

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
forkfork / lux_coding_test.md
Last active Mar 12, 2018
Lux Coding Test Node.js
View lux_coding_test.md

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 "https://api.luxgroup.com/api/public-offers/", 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
Currently:
- 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
forkfork / ioredis_example.js
Last active Apr 13, 2021
Example of using Redis Streams with Javascript/ioredis
View ioredis_example.js
var Redis = require('ioredis');
var redis = new Redis({
host: "nodesydney.wiftycloud.com",
password: "7884b8baaa49fbcb48f17ad2a146"
});
async function main() {
// write an event to stream 'events', setting 'key1' to 'value1'
await redis.sendCommand(
@forkfork
forkfork / Getting_Started.md
Last active Dec 16, 2017
Getting Started - Event Streaming in 10 minutes
View Getting_Started.md

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.

Concepts

Events are has the follow attributes:

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

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 = js.global:fetch(url)
promise["then"](promise, function(_, res)
local jsonPromise = res:json()
jsonPromise["then"](jsonPromise, function(_, json)
co(json)
end)
end)
@forkfork
forkfork / atomic_redis.md
Last active May 3, 2019
Atomic Json modifications with Redis
View atomic_redis.md

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"]}]'