Skip to content

Instantly share code, notes, and snippets.

@alexis-martel
alexis-martel / main.js
Last active April 30, 2024 08:55
How to use the native Compression Streams API to compress and decompress strings in JavaScript
async function compressAndEncode(inputString) {
const encoder = new TextEncoder();
// Create a ReadableStream from the input string
const inputReadableStream = new ReadableStream({
start(controller) {
controller.enqueue(encoder.encode(inputString));
controller.close();
}
});
@carlosame
carlosame / enhance-git-bash.md
Last active April 30, 2024 02:16
Install additional commands on Git Bash (Windows 10)

Install additional commands on Git Bash (Windows 10)

This assumes that your Git Bash is using MSYS instead of Cygwin (look at the output of uname -o if you are in doubt). If you are using Cygwin, please refer to standard Cygwin procedures.

  1. Open http://repo.msys2.org/msys/x86_64/ (or one of the mirrors at https://github.com/msys2/MSYS2-packages/blob/master/pacman-mirrors/mirrorlist.msys) and download the commands that you want to add.
  2. Extract the content of the package that you want to install to a working directory. For example,
    mkdir tmp
    cd tmp
 tar xf ../libzstd-1.4.5-2-x86_64.pkg.tar.xz
@fnky
fnky / ANSI.md
Last active July 8, 2024 17:33
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@stephenmm
stephenmm / file_menu2.bash
Created July 12, 2018 20:23
Interactive and visual selection of array with arrows or 'j' 'k' keys. Can also edit (with autocomplete) the selection
#!/usr/bin/env bash
# Started from this code: https://unix.stackexchange.com/a/415155/14014
# Renders a text based list of options that can be selected by the
# user using up, down, 'j', 'k', and enter keys and returns the
# string in provided file.
# 'e' to edit the current string
# 'q' to quit
#
# Arguments : list of options, maximum of 256
@dmnsgn
dmnsgn / listAllEventListeners.js
Created April 5, 2017 15:40
List all event listeners in a document
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 8, 2024 17:50
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@davispuh
davispuh / steam_console_params.txt
Last active July 5, 2024 17:35
Steam client parameters, consoles commands and variables
-480p - Run tenfoot in 480p rather than 1080p
-720p - Run tenfoot in 720p rather than 1080p
-accesscode -
-all_languages - show longest loc string from any language
-batterytestmode - rapidly cycle battery percentages for testing
-bigpicture - Start in Steam Big Picture mode
-blefw -
-cafeapplaunch - Launch apps in a cyber cafe context
-candidates - Show libjingle candidates for local connection as they are processed
-ccsyntax - Spew details about the localized strings we load
// Typical AMD factory that returns a value, but uses an r-value (sync) require(),
// rather than a long, awkward dependency list.
// You cannot use module.exports or exports to declare the module:
(function (define){
define(function (require) {
"use strict";
var mod = require('pkb/modA');
return {
@btoone
btoone / curl.md
Last active June 29, 2024 16:01
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin