Skip to content

Instantly share code, notes, and snippets.

@matt-e-king
matt-e-king / gtmPlugin.js
Last active December 12, 2024 08:29
Vuex plugin for VueGtm (Google Tag Manager) (https://github.com/mib200/vue-gtm)
/**
Using the Vuex plugin pattern: https://vuex.vuejs.org/en/plugins.html,
this plugin will fire off a gtm.trackEvent for each mutation that occurs within your app.
It will also do a lookup on a literal object methods named after your mutation types. From those methods,
return a object with looks up on the store.
*/
import Vue from 'vue'
// import mutation-types, see example:
/**
@simnalamburt
simnalamburt / README.md
Last active August 3, 2022 09:50
TypeScript vs Flow
@tracker1
tracker1 / debounce.js
Last active September 16, 2018 14:13
Async Generator Stream debounce in JS
// for reference:
// https://www.bignerdranch.com/blog/asyncing-feeling-about-javascript-generators/
// https://gist.github.com/nybblr/3af62797052c42f7090b4f8614b5e157#gistcomment-2044311
const destreamify = async (stream, callback) => {
for await (let event of stream) {
callback(event);
}
};
@Avaq
Avaq / ramda-sanctuary.md
Last active March 1, 2019 00:26
Comprehensive Ramda to Sanctuary list
Ramda Sanctuary
add(a, b) add(b, a)
addIndex(f) ``
adjust(f, i, xs) ``
all(f, xs) ``
allPass(fs, x) allPass(fs, x)
always(x) K(x)
and(a, b) and(a, b)
any(f, x) ``
@JamieMason
JamieMason / es6-compose.md
Last active May 17, 2022 17:38
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduceRight((prevFn, nextFn) =>
    (...args) => nextFn(prevFn(...args)),
    value => value
 );
@xnuk
xnuk / hyeong.md
Last active July 18, 2025 01:13
난해한 혀엉.... 언어

난해한 혀엉... 언어 v0.4.5

  • (U+2026), (U+22EF), (U+22EE)는 모두 .(U+002E)가 3번 연속으로 나열된 것과 같은 것으로 봅니다.
  • "한글 음절 문자"는 가(U+AC00) 이상 힣(U+D7A3) 이하의 유니코드 문자들을 의미합니다.

스택

  • 스택의 모든 원소는 유리수 또는 NaN으로 이루어져 있습니다. 분모가 1인 유리수를 편의상 정수라고 칭합니다.
  • NaN은 특수한 숫자처럼 취급됩니다. 어떠한 연산을 하더라도 그 연산에 NaN이 있을 경우 그 연산의 값은 NaN이 됩니다.
@bobzhang
bobzhang / Comparison of different langauges
Last active January 5, 2023 18:17
Type safe Alt-JS language comparison
A list of languages which compile to JS (Elm, Purescript, OCaml)
(Inspired by this thread: https://groups.google.com/forum/#!topic/elm-discuss/Um7WIBTq9xU)
They all support curry calling convention by default.
Some interesting results:
1. `min` is curried function, only OCaml(BuckleScript) managed to optimize this overhead.
2. All optimize the self tail call
3. Only BuckleScript and PureScript type-specialized comparison functoin (>=) and inlined
@mikemimik
mikemimik / main.dart
Last active August 3, 2022 04:21
Flutter: Custom theme data
import 'package:flutter/material.dart';
import 'theme.dart' as Theme;
void main() {
runApp(
new MaterialApp(
title: 'CompanyApp',
color: Theme.CompanyColors.blue[500],
theme: Theme.CompanyThemeData,
home: new Scaffold(
@nybblr
nybblr / 1-easy.js
Last active July 13, 2022 03:40
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@bisubus
bisubus / ES5-ES6-ES2017-ES2019 omit & pick
Last active April 13, 2024 21:03
ES5/ES6/ES2017/ES2019 omit & pick