Skip to content

Instantly share code, notes, and snippets.

@remybach
remybach / heroesBySeason.json
Created August 1, 2022 07:45
Dice Throne Heroes by Season
{
"seasons": [
{
"name": "Season 1",
"id": "S1",
"colour": "cyan",
"heroes": [
{
"colour": "#53070e",
"name": "Barbarian",
@remybach
remybach / BoardGameGeek.js
Created January 28, 2022 09:27
Board Game Geek Server side JS helper
const fetch = require("@adobe/node-fetch-retry");
const fetchres = require("fetchres");
const { parseStringPromise } = require("xml2js");
// It appears that the node-fetch-retry lib modifies the retryOptions on this object if passed by reference so when using it do it using `{...fetchOptions}`
// Spreading no longer needs to happen once https://github.com/adobe/node-fetch-retry/pull/52 is merged and released.
const fetchOptions = {
retryOptions: {
retryInitialDelay: 1000,
retryOnHttpResponse: response => response.status >= 400 // retry on all 5xx and all 4xx errors

Keybase proof

I hereby claim:

  • I am remybach on github.
  • I am remybach (https://keybase.io/remybach) on keybase.
  • I have a public key whose fingerprint is 3A64 A933 7FF4 957E 3BB8 9554 2556 638F F3A2 131D

To claim this, I am signing this object:

@remybach
remybach / README.md
Last active August 29, 2015 14:17
Raspberry Pi 2 + ADC + Sharp IR Distance Sensor

When I run this with sudo node ir.js I get the following output:

1427574353828 Device(s) undefined
1427574353869 Connected RaspberryPi-IO
1427574353892 Repl Initialized
>> /home/pi/ir_test/node_modules/raspi-io/node_modules/raspi-board/lib/index.js:375
  alias = alias.toString();
               ^
TypeError: Cannot read property 'toString' of undefined
@remybach
remybach / hubot-scripts.json
Created August 24, 2013 08:09
Hubot Scripts
[
"ascii.coffee",
"bitly.coffee",
"chuck-norris.coffee",
"coin.coffee",
"dice.coffee",
"directions.coffee",
"hashing.coffee",
"hubot-irc",
"isup.coffee",
@remybach
remybach / README.md
Last active January 10, 2016 02:20 — forked from hsablonniere/README.md

scrollIntoViewIfNeeded 4 everyone!!!

This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.

Usage

Just use the code in index.js in your app or website. You can see usage in the test page test.html.

The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.

@remybach
remybach / script.coffee
Created May 3, 2013 13:36
Coffeescript output annoyance
foo = 0
bar = 'baz'
@remybach
remybach / Gruntfile.js
Last active December 16, 2015 21:20
Generating a docpad site using Grunt. Not much to this, really... Just use the `grunt-exec` plugin using the config below and you should be good to go.
/*global module */
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
// Other config here.
exec: {
docpad: {
@remybach
remybach / konami.js
Last active December 11, 2015 10:19
Making Konami JS (http://snaptortoise.com/konami-js) a RequireJS (http://requirejs.org) compatible module. Simply add the below to the bottom of your konami js file.
// Export this as a module for RequireJS
typeof define === "function" && define([], function() { return Konami; });
@remybach
remybach / ordinal suffix testing
Created December 20, 2012 12:47
A summary of some testing I did on this jsperf test: http://jsperf.com/ordinal-suffix | Blog post about this here: http://remy.bach.me.uk/2012/12/ordinal-suffix
num = '0'
fastest: `< ternary` slowest: `Regex` by 67%.
num = '1'
fastest: `Regex` slowest: `|| ternary` by 65%
num = '2'
fastest: `< ternary` slowest: `|| ternary` by 64%
num = '3'