This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmartEventTarget extends EventTarget { | |
constructor() { | |
super(); | |
this.handlers = {}; | |
} | |
addEventListener(name, handler) { | |
super.addEventListener(name, handler); | |
if (!this.handlers[name]) { | |
this.handlers[name] = new Set(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('https').get('https://google.com',a=>a.on('data',a=>process.stdout.write(a))).on('error',console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('https').get('https://gist.githubusercontent.com/angstyloop/68f89950977631150867d666675d44e2/raw/b613a86e7319226d5741c0b0b656c7e0ea36b572/gistfile1.txt',a=>a.on('data',a=>process.stdout.write(a))).on('error',console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('https').get('https://www.google.com', it => { | |
console.log('statusCode:', it.statusCode); | |
console.log('headers:', it.headers); | |
it.on('data', it => process.stdout.write(it)); | |
}).on('error', console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# Getting started with GCloud. | |
# You'll need a google developer account, so that you have access to the GCloud | |
# console. You'll need to create a GCloud project and attach a Billing Method | |
# to it. After that you'll need to install the gcloud API. | |
# On Ubuntu, you can do that really quickly with Snap. | |
sudo snap install google-cloud-cli --classic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent { | |
docker { | |
image 'node:lts-bullseye-slim' | |
args '-p 3000:3000' | |
} | |
} | |
stages { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DESCRIPTION | |
# | |
# This is a simple Godot game that lets you move a sprite around in two ways: | |
# | |
# * by clicking, and then without moving, releasing. Then you can drag | |
# the sprite around without holding down the mouse button. When you | |
# want to drop the sprite, release the mouse button. | |
# | |
# * by clicking, and then while holding the mouse button down, dragging | |
# the sprite to where you want it by moving the mouse. When you want |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare global { | |
interface Navigator { | |
msSaveBlob?: (blob: any, defaultName?: string) => boolean | |
} | |
} | |
export default async function saveFile(arrayBuffers: ArrayBuffer[], fileName: string, fileType: string): Promise<void> { | |
return new Promise((resolve, reject) => { | |
const blob = new Blob(arrayBuffers, { type: fileType }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** threshold.c | |
Create a "binary image" from an image - an image with only black (rgb(0, 0, 0)) | |
and white (rgb(255, 255, 255)) pixels, based on a cutoff threshold for the pixel | |
values of the grayscale image. Pixel values above the threshold are set to 255, | |
255, and pixel values below the threshold are set to 0, in the new image. | |
COMPILE | |
gcc -o threshold threshold.c `pkg-config vips --cflags --libs` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** threshold1.c | |
* | |
* COMPILE | |
* | |
* gcc -o threshold1 threshold1.c `pkg-config vips --cflags --libs` | |
* | |
* EXAMPLE | |
* | |
* ./threshold1 128 in.png out.png | |
*/ |
OlderNewer