Skip to content

Instantly share code, notes, and snippets.

View Jensderond's full-sized avatar

Jens de Rond Jensderond

  • Redkiwi
  • The Netherlands
View GitHub Profile
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@jacob-ebey
jacob-ebey / image.ts
Last active February 29, 2024 05:25
Remix Image Component
import { createHash } from "crypto";
import fs from "fs";
import fsp from "fs/promises";
import path from "path";
import https from "https";
import { PassThrough } from "stream";
import type { Readable } from "stream";
import type { LoaderFunction } from "remix";
import sharp from "sharp";
import type { Request as NodeRequest } from "@remix-run/node";

Upcoming Matches ⚽

This easy widget let's you see upcoming matches of your favourite football team.

Guide

  1. Copy this code in a new script in Scriptable app
  2. Find teamId here: https://site.api.espn.com/apis/site/v2/sports/soccer/:league/teams
  3. Find league id: some league abbreviation (EX: 'eng.1' for EPL, 'usa.1' for MLS, 'ned.1' for Dutch Eredivisie)
  4. Change competitionId variable (line 4) with your competition id
  5. Change teamId variable (line 5) with your favourite team id
@dceddia
dceddia / javascript.json
Created October 3, 2019 20:03
VSCode Snippets for React
{
"Insert a function": {
"prefix": "f",
"body": [
"function $1($2) {\n $0\n}\n"
],
"description": "Insert a function"
},
"const arrow": {
"prefix": "c>",
@jschatz1
jschatz1 / brandIcon.js
Created September 25, 2019 15:49
Using Bulma: A little branding for your brand inputs
{
getters: {
brandIcon() {
return (text, defaultIcon) => {
const isBrand = brandIcons.includes(text.toLowerCase());
if (isBrand) {
return `fa-${text.toLowerCase()}`;
}
return `fa-${defaultIcon}`;
};
@sebmarkbage
sebmarkbage / WhyReact.md
Created September 4, 2019 20:33
Why is React doing this?

I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.

I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.

"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr

@chmike
chmike / checkDomain.go
Last active December 1, 2023 19:21
Check domain name validity in Go
// Please use the package https://github.com/chmike/domain as is it maintained up to date with tests.
// checkDomain returns an error if the domain name is not valid.
// See https://tools.ietf.org/html/rfc1034#section-3.5 and
// https://tools.ietf.org/html/rfc1123#section-2.
func checkDomain(name string) error {
switch {
case len(name) == 0:
return nil // an empty domain name will result in a cookie without a domain restriction
case len(name) > 255:
@superjose
superjose / .gitlab-ci.yml
Last active February 19, 2024 10:22
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@noln
noln / ffmpeg_commands.txt
Last active March 22, 2024 16:43
Handy FFMPEG Commands for Quickly Processing GoPro Videos
1) Concatenate a list of videos into one
ffmpeg -f concat -safe 0 -i tojoin.txt -c copy output.mp4
// Format of tojoin.txt:
file 'file0.MP4'
file 'file1.MP4'
file 'etc..
2) Scale down 4k video to
@parmentf
parmentf / GitCommitEmoji.md
Last active April 24, 2024 13:34
Git Commit message Emoji