Skip to content

Instantly share code, notes, and snippets.

View thatkookooguy's full-sized avatar

Neil Kalman thatkookooguy

View GitHub Profile
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@thatkookooguy
thatkookooguy / thatkookooguy_osx_bootstrap.sh
Last active June 6, 2021 08:16
thatkookooguy osx bootstrap
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@callumlocke
callumlocke / .zshrc
Last active March 24, 2024 08:12
ZSH function to auto-switch to correct Node version
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
@thatkookooguy
thatkookooguy / objectMapper.js
Last active January 1, 2019 23:30
create a specific output value from any input object based on a mapper object. originally designed to allow achievibit (achievibit.kibibit.io) to work with multiple git cloud networks (GitHub, Gitlab, Bitbucket, etc.)
/**
* @fileOverview trying to create a general mapping utility.
* please credit me if you use this :-)
*
* @example
* const requestData = {
* user: 'thatkookooguy',
* project: 'achievibit',
* more: {
* user: 'ortichon'
@thatkookooguy
thatkookooguy / sum-pipe.js
Last active January 1, 2019 23:30
an example on how to create pipe functions that behave nicely when used
function sum(initialValue) {
// we need both of these here to allow returning
// the result if no number was added
innerSum.result = initialValue;
innerSum.toString = () => innerSum.result;
return innerSum;
function innerSum(addedValue) {
innerSum.result += addedValue;
@pantharshit00
pantharshit00 / app.js
Last active August 22, 2021 21:20
Simple express app using JWT authentication
/**
* To get started install
* express bodyparser jsonwebtoken express-jwt
* via npm
* command :-
* npm install express body-parser jsonwebtoken express-jwt --save
*/
// Bringing all the dependencies in
const express = require('express');
@jmakeig
jmakeig / callback.js
Last active November 19, 2022 23:59
JSDoc/Documentation.js examples
/**
* A success callback for {@link ResultProvider} that receives the result from
* the {@link documents#probe}.
* @callback documents#probeResult
* @since 1.0
* @param {documents.DocumentDescriptor} document - a sparse document descriptor with an exists
* property that identifies whether the document exists
*/
/**
* Probes whether a document exists; takes a configuration
@inakianduaga
inakianduaga / IWebhook.ts
Created October 29, 2015 22:01
Github webhook events typescript types
/**
* Github Webhook event types
* https://developer.github.com/v3/activity/events/types/
*/
module IWebhook {
interface IUser {
login: string,
id: number,
avatar_url: string,
@arielsalminen
arielsalminen / converts-webfont-to-base64.js
Last active August 28, 2020 06:07
Convert Google WOFF font to base64 format and inline to <head> of document
// Get binary file using XMLHttpRequest
function getBinary(file) {
var xhr = new XMLHttpRequest();
xhr.open("GET", file, false);
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.send(null);
return xhr.responseText;
}
// Base64 encode binary string
@amogram
amogram / chocolatey-env-setup.ps1
Last active August 17, 2021 14:19
A Chocolatey script for PowerShell I use to set up my Windows development environment. I use this when setting up my own Dev VMs. Use at your own risk.See http://bit.ly/1a301JK and http://chocolatey.org/ for more information.
# Simple environment setup script
# Install Applications
choco install fiddler4
choco install notepadplusplus
choco install visualstudiocode
choco install greenshot
choco install GoogleChrome
choco install putty
choco install ccleaner