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
@remybach
remybach / twilight.css
Created July 23, 2012 16:45
Twilight theme for Highlight.js (not extensive or fully complete, mainly CSS, JS, XML, and HTML)
pre {
background:#141414; /* hsl(0, 0%, 8%) */
color:#FFF;
padding:5px;
white-space:pre;
-webkit-border-radius:5px; /* Saf3-4, iOS 1-3.2, Android ≤1.6 */
border-radius:5px; /* Opera 10.5, IE9, Saf5, Chrome, FF4+, iOS 4, Android 2.1+ */
}
pre ::selection {
@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 / 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 / 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'
@remybach
remybach / index.markdown
Created November 23, 2012 00:35
A CodePen by Rémy Bach. Can't Touch This! - I was reminded of something from way back in the day where there was a button on the screen that dodged your mouse every time you came close to it. After trying to hunt it down, I thought I'd quickly throw my ow