Skip to content

Instantly share code, notes, and snippets.

View bytespider's full-sized avatar

Rob Griffiths bytespider

View GitHub Profile
@wesbos
wesbos / README.md
Last active October 20, 2026 10:42
Find high-churn folders driving Backblaze bztransmit CPU crazy on macOS

Finding high-churn folders that drive Backblaze's bztransmit crazy

Your Mac's bztransmit is pinning a CPU core. Backblaze's status says a puzzling amount of "remaining files". The cause: some app is churning out thousands of tiny files — mostly caches — and Backblaze is deduping, checksumming and uploading every one of them, all day.

This is a walkthrough of how to find the offenders and exclude them, plus the measured results and the catch nobody mentions (exclusions fix the churn, but not all of the CPU — see the end).

@MendyLanda
MendyLanda / drizzle-ulid.md
Created November 5, 2023 13:29
Implementing Efficient Binary ULID Storage in MySQL with Drizzle ORM

For anyone considering the use of ULIDs in MySQL with drizzle, here's a ready-to-use ULID type for your convenience.

import { Ulid as ULID } from "id128";

export const ulid = customType<{
  data: string;
  notNull: true;
  default: false;
@colemanw
colemanw / font-awesome-mime-type-icons.php
Last active June 5, 2025 19:55 — forked from gdressel/font-awesome-mime-type-icons.php
Font Awesome File Icons: Mapping MIME Types to correct icon classes
<?php
/**
* Get font awesome file icon class for specific MIME Type
* @see https://gist.github.com/guedressel/0daa170c0fde65ce5551
*
*/
function ($mime_type) {
// List of official MIME Types: http://www.iana.org/assignments/media-types/media-types.xhtml
$icon_classes = array(
@mjackson
mjackson / color-conversion-algorithms.js
Last active September 12, 2026 07:28
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@creationix
creationix / hidepatch.js
Created March 20, 2013 16:24
Idea to make private properties and methods non-enumerable instead of prefixing them with underscores (in ES5 and above environments of course)
Object.defineProperty(Object.prototype, "hide", {
value: function () {
[].forEach.call(arguments, function (name) {
var descriptor = Object.getOwnPropertyDescriptor(this, name);
if (descriptor.enumerable) {
descriptor.enumerable = false;
Object.defineProperty(this, name, descriptor);
}
}, this);
}

Node.js Resources

What is node.js?

Node.js is just JavaScript running on the server side. That's it. That's all there is to it.

Express

  • Express Docs, if you want to get started and already know JavaScript this is the place to be
@max-mapper
max-mapper / readme.md
Last active October 12, 2015 10:17
introduction to node
@peterjmit
peterjmit / benchmark.sh
Created October 10, 2012 10:49
Bash Benchmark Script (using time)
#!/bin/bash
# REQUIRES SUDO
# Benchmark runner
repeats=20
output_file='benchmark_results.csv'
command_to_run='echo 1'
run_tests() {
# --------------------------------------------------------------------------
@tnydwrds
tnydwrds / jquery_transport.js
Created October 14, 2011 15:51
Quick jQuery Transport sample
// This is currently just a proof of concept. My OAuth usage requires setting
// a cookie client-side (server does not do this) after successful authentication.
// AIR runtime does not allow XHR to set cookie header so I had to use AIR's
// URLRequest object.
//
// I imagine you can do the same thing but use jsOAuth.request or something in
// place of URLRequest
//
// http://api.jquery.com/extending-ajax/#Transports
@tvandervossen
tvandervossen / gist:1231476
Created September 21, 2011 07:33
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3