Skip to content

Instantly share code, notes, and snippets.

View tonidy's full-sized avatar

toni dy tonidy

View GitHub Profile
@evanw
evanw / 0_stackify.ts
Last active June 28, 2025 01:14
Example "stackify" algorithm for turning SSA into WASM
// This code demonstrates a simplified "stackification" algorithm to turn
// instructions in a basic block back into a tree. This is useful when
// generating WebAssembly code from assembly instructions in SSA form.
//
// It's the algorithm used by LLVM's WebAssembly backend, viewable here:
// https://github.com/llvm-mirror/llvm/blob/master/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
type InsKind =
'Add' |
'LocalSet' |
@siwalikm
siwalikm / aes-256-cbc.js
Last active June 30, 2025 15:37
AES-256-CBC implementation in nodeJS with built-in Crypto library
'use strict';
const crypto = require('crypto');
const ENC_KEY = "bf3c199c2470cb477d907b1e0917c17b"; // set random encryption key
const IV = "5183666c72eec9e4"; // set random initialisation vector
// ENC_KEY and IV can be generated as crypto.randomBytes(32).toString('hex');
const phrase = "who let the dogs out";
var encrypt = ((val) => {
@NigelEarle
NigelEarle / Knex-Setup.md
Last active March 15, 2025 16:49
Setup Knex with Node.js

Knex Setup Guide

Create your project directory

Create and initialize your a directory for your Express application.

$ mkdir node-knex-demo
$ cd node-knex-demo
$ npm init
@romainl
romainl / javascript_deep_dive.md
Created October 7, 2017 19:28 — forked from faressoft/javascript_deep_dive.md
JavaScript Deep Dive to Crack The JavaScript Interviews
@angry-dan
angry-dan / bitbucket-pipelines.yml
Last active June 29, 2022 04:54
A small script to run as part of your bitbucket pipelines to deploy code from the Bitbucket repository into an external git repository, tested with Acquia so far. Configure SSH keys and the DEPLOY_URL variable in the BitBucket UI to make it work. Assumes a Drupal install in /docroot and node stuff in /app
image: node:7.4
# Yes, you do need this in order to be able to do onward pushes.
clone:
depth: full
pipelines:
default:
# Don't forget caches as well.
- step:
@jehugaleahsa
jehugaleahsa / web-circles.md
Last active August 30, 2023 18:37
Razor and TypeScript

Once more around the bend

We're just going in circles...

If you have been a web developer for a while, you probably feel like you're going in circles. Going all the way back to CGI scripts, you were generating HTML using string literals, formatting and concatenation:

const message = "Hello, World!!!"
console.log("<html><body>" + message + "</body></html>");

Then someone decided it would be easier to inline code into HTML documents directly, using a more declarative approach:

@HyperBrain
HyperBrain / lifecycle-cheat-sheet.md
Last active March 14, 2025 05:30
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@fred-stripe
fred-stripe / main.go
Created May 19, 2017 19:30
Simple webhook example in Go
package main
import(
"fmt"
"log"
"encoding/json"
"net/http"
"os"
"github.com/stripe/stripe-go/client"
"github.com/stripe/stripe-go"
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 5, 2025 10:43
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example