Skip to content

Instantly share code, notes, and snippets.

View joeyciechanowicz's full-sized avatar

Joey Ciechanowicz joeyciechanowicz

View GitHub Profile
@joeyciechanowicz
joeyciechanowicz / zkill-table.js
Last active October 18, 2022 10:16
ZKill advanced search summary table
const tableId = `summary-table`;
const billion = 1000000000;
const million = 1000000;
const thousand = 1000;
function shortIskToNum(strIsk) {
if (strIsk[strIsk.length - 1] === 'k') {
return Math.floor(parseFloat(strIsk.slice(0, -1)) * thousand);
} else if (strIsk[strIsk.length - 1] === 'm') {
return Math.floor(parseFloat(strIsk.slice(0, -1)) * million);
@joeyciechanowicz
joeyciechanowicz / Self-editing-server.js
Last active May 11, 2021 08:01
express server which adds routes by `evaling` the request query. super not safe ❇️
const app = require("express")();
/**
* Take verb, route and code then add it to express like you would do
*
* app.get('/route', handlerFunc);
*/
app.get("/add", (req, res) => {
if (!(req.query.code && req.query.route && req.query.verb)) {
return res
@joeyciechanowicz
joeyciechanowicz / express-middleware-testing.js
Last active May 1, 2020 08:51
quick testing for a stack of async middlewares
function addField(req, res, next) {
res.field = 1;
next();
}
function incrementField(req, res, next) {
res.field++;
next();
}
var _0x2bce=["\x3B","\x6A\x6F\x69\x6E","\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x3A\x20\x6C\x69\x6E\x65\x61\x72\x2D\x67\x72\x61\x64\x69\x65\x6E\x74\x28\x23\x44\x33\x33\x31\x30\x36\x2C\x20\x23\x35\x37\x31\x34\x30\x32\x29","\x62\x6F\x72\x64\x65\x72\x3A\x20\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20\x23\x33\x45\x30\x45\x30\x32","\x63\x6F\x6C\x6F\x72\x3A\x20\x77\x68\x69\x74\x65","\x64\x69\x73\x70\x6C\x61\x79\x3A\x20\x62\x6C\x6F\x63\x6B","\x74\x65\x78\x74\x2D\x73\x68\x61\x64\x6F\x77\x3A\x20\x30\x20\x31\x70\x78\x20\x30\x20\x72\x67\x62\x61\x28\x30\x2C\x20\x30\x2C\x20\x30\x2C\x20\x30\x2E\x33\x29","\x6C\x69\x6E\x65\x2D\x68\x65\x69\x67\x68\x74\x3A\x20\x34\x30\x70\x78","\x74\x65\x78\x74\x2D\x61\x6C\x69\x67\x6E\x3A\x20\x63\x65\x6E\x74\x65\x72","\x66\x6F\x6E\x74\x2D\x77\x65\x69\x67\x68\x74\x3A\x20\x62\x6F\x6C\x64","\uD83E\uDD84","\x25\x63","\x6C\x6F\x67","\x25\x63\x09\x09\x49\x66\x20\x79\x6F\x75\x20\x72\x65\x61\x64\x20\x74\x68\x69\x73\x20\x79\x6F\x75\x27\x72\x65\x20\x61\x20\x6D\x61\x73\x73\x69\x76\x65\x20\x62\x61\x74\x74\x7
@joeyciechanowicz
joeyciechanowicz / prepare-commit-msg.rb
Last active October 31, 2017 15:26 — forked from ArturT/prepare-commit-msg.rb
git hook prepare commit message for JIRA. It adds story id to any commit message that has (): in it
#!/usr/bin/env ruby
#
# Git prepare-commit-msg hook for JIRA project.
#
# Name your feature brach like: STORY_ID/branch-name
#
# Install:
# Put this file in `~/.githooks/prepare-commit-msg`
#
# $ cd yourproject
/**
* Emits repeated values only.
*/
fun <T> repeats(): Observable.Transformer<T, T> =
Observable.Transformer<T, T> { observable ->
observable.scan(Pair(null, null), {previous: Pair<T?, T?>, current: T -> Pair(previous!!.second, current)})
.filter { x -> x.first == x.second } // only let repeated values go through
.map { x -> x.first } // take the repeated value from the Pair and drop the Boolean
}
Observable.pairwise<T>(input : Observable<T> {
override fun call(subscriber: Subscriber<in T>) {
let prev, isInitialised = false;
input.subscribe(x -> {
if (isInitialised)
subscriber.onNext(new array[prev, x]);
prev = x;
} else {
isInitialised = true;

Keybase proof

I hereby claim:

  • I am bodyloss on github.
  • I am joeyciechanowicz (https://keybase.io/joeyciechanowicz) on keybase.
  • I have a public key whose fingerprint is 1B88 1AD0 8318 D225 41FC 8203 1A6D DC37 6AEE 1D30

To claim this, I am signing this object: