Skip to content

Instantly share code, notes, and snippets.

View satyavh's full-sized avatar

Satya van Heummen satyavh

  • Netherlands
View GitHub Profile
@hosuaby
hosuaby / cypress-partial.js
Created December 3, 2021 20:14
Primitive load-balancer to run Cypress specs in parallel on CI without recording
/**
* Primitive load-balancer to split Cypress specs across multiple runners. This script assumes that
* all your specs are in the folder '<project root>/cypress/integration'. It uses the number of
* tests per spec file as sole criteria to split specs between runners.
*
* This script accepts two arguments: the total number of runners and the index (starting from 0) of
* the current runner. Example:
* $ node cypress-partial.js 5 2
* This command asks for specs to give to the third runner of five runners.
* The output of the script is a coma-separated list of specs that can be given to Cypress. Example:
@mackbrowne
mackbrowne / gist:30317eba75d13683566ead357b52bbce
Last active June 19, 2017 15:09
Accounts Meteor Link Hack
Accounts.onCreateUser((options, user) => {
user.city = null;
user.networks = [];
user.attending = [];
if (user.profile == null) {
user.profile = {};
}
if (user.services != null) {
var service = _.keys(user.services)[0];
@tomysmile
tomysmile / mac-php-composer-setup.md
Created July 11, 2016 10:45
Setup PHP Composer using Brew
@themeteorchef
themeteorchef / timezones.js
Last active February 8, 2024 13:07
Array of timezones as objects, sorted by offset and name.
[
  {
    "offset": "GMT-12:00",
    "name": "Etc/GMT-12"
  },
  {
    "offset": "GMT-11:00",
    "name": "Etc/GMT-11"
  },
  {
@themeteorchef
themeteorchef / timezones.json
Last active February 19, 2021 09:12
Timezones by UTC Offset
[
{
"value":"International Date Line West",
"name":"(GMT-11:00) International Date Line West"
},
{
"value":"Midway Island",
"name":"(GMT-11:00) Midway Island"
},
{
<template name="openModal">
<button class="button" {{bind 'openModal: myModalTemplate'}}>Open modal</button>
</template>
@dcollien
dcollien / ImageTools.es6
Last active April 28, 2023 09:00
Resize Images in the Browser
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}());
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () {
try {
@osteenbergen
osteenbergen / example.js
Created April 23, 2015 12:08
Laterjs Timezone support with MomentJS Timezone library
// Timezone library
var moment = require("moment-timezone");
// Later
var later = require("later");
// The schedule we would like to support:
var sched = later.parse.text("at 17:00");
// In March CET switches to CEST (daylight saving) so this is a nice example
var timezone = "Europe/Amsterdam";
@jamesgpearce
jamesgpearce / dimoc.md
Last active September 22, 2017 23:34
DIMOC: Do It Myself or Callback - a simple pattern for React components

TLDR: a React component should either manage its own state, or expose a callback so that its parent can. But never both.

Sometimes our first impulse is for a component to entirely manage its own state. Consider this simple theater seating picker that has a letter for a row, and a number for a seat. Clicking the buttons to increment each value is hardly the height of user-interface design, but never mind - that's how it works:

/* @flow */
var React = require('react');

var Letter: React.ReactClass = React.createClass({
  getInitialState: function(): any {
@radzserg
radzserg / meteor pagination class
Last active October 19, 2016 20:34
meteor pagination class
namespace('App.data')
###
Meteor pagination class
Usage
UsersController = RouteController.extend
waitOn: ->
@page = @params.query.page || 1
@pagination = new App.data.Pagination(Users, selector, {page: @page})