Skip to content

Instantly share code, notes, and snippets.

// Copy-paste into your console (or minify and save as a bookmarklet) to see any DOM in an almost-sorta-working 3D stack of DOM elements.
// The front faces are colored for debugging, if this gist can be fixed, they can return to their normal styling.
(function () {
const MAX_ROTATION = 180;
const DEPTH_INCREMENT = 25;
const PERSPECTIVE = 1000;
const SIDE_FACE_CLASS = 'side-face';
const MAX_DOM_DEPTH = getMaxDepth(document.body);
// Calculate color based on depth, ensuring lighter colors for deeper elements
@sunny-g
sunny-g / readme.md
Created December 15, 2023 21:47 — forked from firexcy/readme.md
DIY a Rewind.ai

This Gist provides a solution to periodically capture screenshots of your Mac, and create therefrom a searchable PDF archive so that you can always get an answer to the “what, when, and where” questions about your usages.

To use these scripts:

  1. Download the shell script rewind, then:
    1. put it under ~/bin (or other fixed path you prefer);
    2. execute
@sunny-g
sunny-g / hvm.rs
Created June 22, 2023 20:16 — forked from VictorTaelin/hvm.rs
Self-Contained HVM as a single Rust file with no FreeList
#![allow(clippy::identity_op)]
#![allow(dead_code)]
#![allow(non_snake_case)]
use std::collections::{hash_map, HashMap};
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use rand::prelude::*;
use std::time::Instant;
@sunny-g
sunny-g / notes.md
Created June 7, 2023 15:25 — forked from binji/notes.md
Compiling LLVM/Clang for Wasm notes
  • How to Cross Compile LLVM: https://llvm.org/docs/HowToCrossCompileLLVM.html
  • Building LLVM with CMake: https://llvm.org/docs/CMake.html
  • Hints from wasi-sdk Makefile: https://github.com/CraneStation/wasi-sdk/blob/master/Makefile
  • Try compiling natively (needed for llvm-tblgen and clang-tblgen)
    • cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;WebAssembly" -DLLVM_ENABLE_PROJECTS="lld;clang" ../llvm
  • Try building LLVM with WASI:
  • cmake -G Ninja -DCMAKE_AR=”/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-ar” -DCMAKE_RANLIB=”/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-ranlib” -DCMAKE_C_COMPILER="/usr/local/google/home/binji/dev/wasi-sdk-5.0/opt/wasi-sdk/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/google/home/binji/dev/wasi-sdk-5.0/opt/wasi-sdk/bin/clang++" -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/usr/local/google/home/binji/dev/wasi-clang -DLLVM_TABLEGEN=/usr/local/google/home/binji/dev/llvm-project/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/
Verifying my Blockstack ID is secured with the address 17b4KwXNs98zb6Y13G4cKQApaxKjDB6JLL https://explorer.blockstack.org/address/17b4KwXNs98zb6Y13G4cKQApaxKjDB6JLL

System Design Cheatsheet

Step One: Framing The Problem a.k.a get the MVP

  • Identify the use cases that are in scope
  • Determine constraints based on scoped use cases

use case : the things your system needs to be do.

constraints : the things your system will have to consider to be able to do stuff

@sunny-g
sunny-g / The Technical Interview Cheat Sheet.md
Created May 24, 2016 21:44 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@sunny-g
sunny-g / frp.md
Created March 18, 2016 17:32 — forked from ohanhi/frp.md
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Foreword

@sunny-g
sunny-g / 01-createObservableFromDeviceEventEmitter.js
Created March 18, 2016 02:21 — forked from sectore/01-createObservableFromDeviceEventEmitter.js
[React Native + RxJS] Create an Observable from DeviceEventEmitter - An example to handle 'locationUpdated' event
import React, {DeviceEventEmitter} from 'react-native';
import {Observable} from 'rx-lite'
/**
* Creates an Observable to listen to any event of DeviceEventEmitter
* @param type {string} Event type
*/
export default createObservableFromDeviceEventEmitter$ = type => {
let subscription;
return Observable.fromEventPattern(