Skip to content

Instantly share code, notes, and snippets.

View syzer's full-sized avatar
🐕
Woof! Woof!

syzer syzer

🐕
Woof! Woof!
View GitHub Profile
@syzer
syzer / medium.user.js
Created August 20, 2024 09:52 — forked from mathix420/medium.user.js
Bypass Medium Paywall - Working late 2023 - Greasy Fork, Violentmonkey, Tampermonkey - Click the RAW button to install
// ==UserScript==
// @name Medium Paywall Bypass
// @namespace Violentmonkey Scripts
// @run-at document-start
// @match *://*.medium.com/*
// @match *://medium.com/*
// @match *://*/*
// @grant none
// @version 2.4
// @inject-into content
@syzer
syzer / Intro to Common Table Expressions.md
Created December 22, 2023 12:23 — forked from felixyz/Intro to Common Table Expressions.md
Introduction to transitive closure / Common Table Expressions / iterative queries in SQL

Teh Social Netswork!

CREATE TABLE users (
 id SERIAL PRIMARY KEY,
 name VARCHAR(10) NOT NULL
);

INSERT into users VALUES

@syzer
syzer / pipeP.js
Created April 5, 2023 11:43
Piping via Ramda with Promises and/or plain functions
const _p = unapply(pipeWith(andThen))
@syzer
syzer / pre-commit.sh
Created June 13, 2022 09:13
Precommit hook to skip committing when CHANGELOG not updated
#!/bin/bash
#in .git/pre-commit
lint-staged
# CHANGELOG
if git status -s | grep -q "M CHANGELOG.md"; then
echo "# CHANGELOG Not updated."
exit 1
else
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).R={})}(this,function(t){"use strict";function a(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function o(r){return function t(n){return 0===arguments.length||a(n)?t:r.apply(this,arguments)}}function n(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return a(n)?t:o(function(t){return e(n,t)});default:return a(n)&&a(r)?t:a(n)?o(function(t){return e(t,r)}):a(r)?o(function(t){return e(n,t)}):e(n,r)}}}var r=n(function(t,n){return+t+ +n});function i(t,n){var r,e=(t=t||[]).length,u=(n=n||[]).length,i=[];for(r=0;r<e;)i[i.length]=t[r],r+=1;for(r=0;r<u;)i[i.length]=n[r],r+=1;return i}function f(t,s){switch(t){case 0:return function(){return s.apply(this,arguments)};case 1:return function(t){return s.apply(this,arguments)};case 2:return function(t,n){return s.apply(this,arguments)};case 3:return function(t,n,r){retu
@syzer
syzer / QantilevsMedian.js
Last active August 19, 2021 16:55
How many to solve to improve percentile using ramda.js
// sort array ascending
const asc = arr => arr.sort((a, b) => a - b);
// sample standard deviation
const std = (arr) => {
const mu = mean(arr)
const diffArr = arr.map(a => (a - mu) ** 2)
return Math.sqrt(sum(diffArr) / (arr.length - 1))
}
@syzer
syzer / angular-hmr-remove-ref.js
Created February 6, 2020 13:28
When ref stayed in the nodes
platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
// Ensure Angular destroys itself on hot reloads.
if (window['ngRef']) {
window['ngRef'].destroy();
}
window['ngRef'] = ref;
// Otherwise, log the boot error
}).catch(err => console.error(err));
@syzer
syzer / bumpPackages.sh
Created October 31, 2019 14:14
Bump packages
VERSIONS="
1.2.3.3
1.2.4
2.9.9
2.9.0
"
for VERSION in $VERSIONS; do
echo $VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
done
@syzer
syzer / test-npm-cli.sh
Created October 17, 2019 13:20
test npm cli tool locally before is published to registry
npm publish
npm i --globally message-que-0.5.5.tgz
ls -ln ~/.nvm/versions/node/v12.10.0/bin/
@syzer
syzer / asyncReduce.js
Created October 20, 2018 19:40
Use reduce for serial async resolution AKA map.series
const asyncFunction = (nextID) =>
new Promise((resolve, reject) => {
setTimeout(() => {
console.log(`Called with ${new Date()}`)
resolve()
}, 1000)
})
;[1, 2, 3].reduce((accumulatorPromise, nextID) => {
console.log(`Looped with ${new Date()}`)