Skip to content

Instantly share code, notes, and snippets.

View jmshal's full-sized avatar

Jacob Marshall jmshal

  • New Zealand
View GitHub Profile
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const AppendInitVect = require('./appendInitVect');
const getCipherKey = require('./getCipherKey');
function encrypt({ file, password }) {
// Generate a secure, pseudo random initialization vector.
@ebidel
ebidel / coverage.js
Last active September 24, 2023 10:25
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
#!/usr/bin/env bash
AZ_PATH=$HOME
AZ_CONTAINER_NAME=azure-cli
AZ_IMAGE_TAG=azure-cli
az() {
docker exec -it $AZ_CONTAINER_NAME az "${@}"
}
@jessicard
jessicard / macarons.md
Last active February 3, 2023 03:53
Macarons!

Basic macaron shell recipe

  • This will make approximately 100 shells, or about 4 dozen cookies
  • When practicing, I generally half this recipe to only make 1 sheet of cookies
  • When making macarons, you will generally flavor the filling but not the shells
  • You want to make the macarons the day before the event. You will store them in the refrigerator over night, and then take them out a few hours before to come to room temperature. This is because macarons are best when "ripened", or allowed to sit for at least one night and have the filling seep into the shells a bit. Otherwise, straight out of the oven, they can be too crunchy or hard
  • Macarons shells freeze well! Filled macarons can also freeze well depending on the filling. Buttercream fillings freeze great. Put the cookies into an airtight container before freezing
  • Everyones baking temperature and baking time vary depending on their oven - you might have to experiment a bit!
  • _I always separate egg whites myself by cracking the egg, p
/**
* JS scoping, and this property resolutions rules in ES7/ES8.
*
* Quiz: x is gone, and x is everywhere!
*
* Help find Xs! What's the output?
*/
let x = 1;
@ghoranyi
ghoranyi / AWS Swarm cluster.md
Last active May 31, 2021 05:28
Create a Docker 1.12 Swarm cluster on AWS

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.

Prerequisites

You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.

@nishanttotla
nishanttotla / swarm-with-docker-machine.sh
Last active May 24, 2019 11:57
A bash script to set up a simple Docker Swarm cluster using Docker Machine
################################## INSTRUCTIONS ##################################
# 1. Make sure docker-machine is installed on your machine #
# 2. Download the file #
# 3. Run using $ . swarm-with-docker-machine.sh so that DOCKER_HOST is exported #
##################################################################################
# Remove any existing machines
docker-machine rm -y manager agent1 agent2
# Create machines
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@iamralch
iamralch / subcommand.go
Created July 4, 2015 15:50
flag package: subcommand example
package main
import (
"flag"
"fmt"
"os"
)
func main() {
askCommand := flag.NewFlagSet("ask", flag.ExitOnError)