Skip to content

Instantly share code, notes, and snippets.

View MultiCoinCharts's full-sized avatar

MultiCoinCharts (Pre-public) MultiCoinCharts

View GitHub Profile
@spencerpogo
spencerpogo / SimpleDiscordCrypt.plugin.js
Last active May 5, 2022 17:15
Simple Discord Crypt BetterDiscord Plugin
//META{"name":"SimpleDiscordCrypt","source":"https://github.com/Scoder12/RepoTBD","website":"https://scoder12.ml","authorId":"339943808584384512"}*//
/*@cc_on
@if (@_jscript)
var shell = WScript.CreateObject("WScript.Shell");
var fs = new ActiveXObject("Scripting.FileSystemObject");
var pathPlugins = shell.ExpandEnvironmentStrings("%APPDATA%\\BetterDiscord\\plugins");
var pathSelf = WScript.ScriptFullName;
shell.Popup("It looks like you've mistakenly tried to run me directly. \\n(Don't do that!)", 0, "I'm a plugin for BetterDiscord", 0x30);
if (fs.GetParentFolderName(pathSelf) === fs.GetAbsolutePathName(pathPlugins)) {
function useState(value) {
const {caller} = arguments.callee;
const {arguments: a} = caller;
const {stack} = useState;
if (!stack.has(caller))
stack.set(caller, {a, i: 0, s: []});
const state = stack.get(caller);
state.a = a;
const {i, s} = state;
if (i === s.length) {
@dfkaye
dfkaye / bodil-miracle-of-generators.md
Last active September 25, 2021 00:42
Notes from Bodil Stokke's "The Miracle of Generators" presentation from the Front Conference Zurich

Notes from Bodil Stokke's "The Miracle of Generators"

Presented at Front Conference Zurich 31 August - 1 September 2017

Video at https://vimeo.com/232221648

Our little data

var ponies = [

@WebReflection
WebReflection / why-i-use-web-components.md
Last active October 18, 2024 10:55
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

@kphillisjr
kphillisjr / QueryDotnet.js
Created August 22, 2018 23:47
JSCript.NET Working Examples
/*
To Compile:
PATH\\TO\\jsc.exe QueryDotnet.js
This example is based on:
https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
*/
import System;
import Microsoft.Win32;
// now an npm package qith 100% code coverage:
// https://github.com/WebReflection/endow#endow---
// (c) Andrea Giammarchi, @WebReflection (ISC)
const mix = Super => ({
with: (...mixins) =>
mixins.reduce(
(Class, Mixin) => {
Class = Mixin(Class);
if (!Mixin.hasOwnProperty(Symbol.hasInstance)) {
@soareschen
soareschen / metaprogramming-with-proxy.js
Created September 25, 2017 07:49
Metaprogramming in JavaScript using proxy and with statement
/*
This code snippet demonstrates how to do metaprogramming
in JavaScript using proxy and with statement.
Run this in non-strict mode.
*/
const proxy = new Proxy({}, {
get(target, key) {
if(key === Symbol.unscopables) return {}
return `${key.toUpperCase()} `
},
@WebReflection
WebReflection / extensible.js
Last active April 4, 2021 00:34
A simple way to create objects usable to extends other objects or classes.
function extensible(object) {
// usable to extend a class
function descriptors() {}
// get rid of name, length, and the rest
Reflect.ownKeys(descriptors).forEach(function (k) {
delete descriptors[k];
});
// clean up the constructor too
descriptors.prototype = {};
// per each property in object
@WebReflection
WebReflection / super.js
Last active April 4, 2021 00:33
Using `this.super()` and `this.super.method()` via any kind of object or prototype (proof of concept)
var withSuperContext = (function (Object) {
//! (c) Andrea Giammarchi
var
defineProperty = Object.defineProperty,
getPrototypeOf = Object.getPrototypeOf,
setPrototypeOf = Object.setPrototypeOf ||
function (o, p) { o.__proto__ = p; },
handler = {
get: function get(target, property, receiver) {
return function () {
@WebReflection
WebReflection / state.js
Created May 13, 2016 10:16
Prototypal inheritance used to define states.
/*! (c) 2016 Andrea Giammarchi - MIT Style License */
// simple state-like objects handler
// based on prototypal inheritance
function State() {'use strict';}
// States are serializable dictionaries
// toJSON and toString are the only reserved keywords
// every other name can be used as name (included __proto__)