Skip to content

Instantly share code, notes, and snippets.

View Jerska's full-sized avatar
👻
Software Engineer at @algolia

Matthieu Dumont Jerska

👻
Software Engineer at @algolia
View GitHub Profile
new Crawler({
appId: "FIXME",
apiKey: "FIXME",
indexPrefix: "crawler_FIXME_",
rateLimit: 4,
maxUrls: 100,
startUrls: ["FIXME"],
ignoreQueryParams: ["utm_medium", "utm_source", "utm_campaign", "utm_term"],
actions: [
{
@Jerska
Jerska / 1. stableJSONStringify.ts
Last active December 19, 2019 10:11
Stable JSON stringify
// Make sure JSON keys are always in the same order, to allow for easy comparison
// This uses JSON.stringify's replacer twice:
// - once to get the list of keys, including of nested children
// - once in its lesser known form: as a array of keys
// this filters keys to only ones in the list - (we don't use this feature)
// but also sorts them, and this is why this is useful to us
export function stableJSONStringify(obj: any) {
const allKeys: string[] = [];
// Use the replacer function to get the keys
@Jerska
Jerska / micromatch-benchmark.js
Created August 6, 2019 15:53
Micromatch caching benchmark
/* eslint-disable no-console, import/no-extraneous-dependencies */
const micromatch = require('micromatch');
const NB_PAGES = 50 * 1000;
const NB_MATCHES = 2000;
const STAR_RATIO = 0.1;
const NEGATION_RATIO = 0.1;
const base = 'https://www.example.com';
@Jerska
Jerska / config.yml
Last active December 31, 2019 15:47
Sample CircleCI configuration
version: 2
jobs:
build:
environment:
- TEST: true
docker:
- image: debian:stretch
steps:
@Jerska
Jerska / README.md
Last active November 7, 2017 17:33
Custom librato client with Node.js

Goals

The goal here was to solve our issues with Librato and Node.js only on a distributed system on Heroku. Here's the list of our issues / questions :

  • we loved how easy the log drain was to use
  • but we sent too much data to use the log drain w/ Heroku so some of it was skipped and the data was inconsistent
  • we had multiple machines updating the same counters (e.g. # of concurrent jobs) and we wanted a rate (concurrent jobs / s accross all machines) : you can't do using counters
  • librato-node uses counters internally when you call increment
  • using librato-node in dev environment requires you to wrap it
  • making a request to the API every 15s would induce performance issues
@Jerska
Jerska / changes.patch
Created October 13, 2017 15:28
Differences algolia
diff --git a/public/shopify/assets/javascripts/algolia_autocomplete.js.liquid b/public/shopify/assets/javascripts/algolia_autocomplete.js.liquid
index 0130d68..be51693 100644
--- a/public/shopify/assets/javascripts/algolia_autocomplete.js.liquid
+++ b/public/shopify/assets/javascripts/algolia_autocomplete.js.liquid
@@ -19,7 +19,7 @@
return algolia.render(params.templates.empty, props);
},
suggestion: function displaySuggestion (hit) {
- return algolia.render(params.templates.hit, hit);
+ return algolia.render(params.templates.hit, Object.assign({ _distinct: params.distinct }, hit));
@Jerska
Jerska / apps.json
Created September 22, 2017 15:15
Top paid and free apps on the app store
[
{
"name": "DHgate Shopping - Buy Fashion Clothing, Electronic",
"genres": [
"Business",
"Shopping"
],
"price": 0,
"rating": 4.5,
"link": "http://itunes.apple.com/app/dhgate-shopping-buy-fashion-clothing-electronic/id905869418?uo=5&at=10l9yE",
@Jerska
Jerska / fullstack-test.md
Last active November 7, 2017 14:35
Full-stack engineering test

Technical Test

The goal of this test is to evaluate your ability to architecture a small full-stack app.

Instructions

The app you need to build is a small AppStore admin page. The initial import dataset can be found here: apps.json. The dataset being a bit old, don't be surprised by missing images.