Skip to content

Instantly share code, notes, and snippets.

Avatar

KRogLA krogla

View GitHub Profile
@krogla
krogla / MiddlewareES6.js
Created Apr 29, 2020 — forked from sylvainleris/MiddlewareES6.js
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
View MiddlewareES6.js
class Middleware {
constructor() {
// Array prototype last
if (!Array.prototype.last) {
Array.prototype.last = function() {
return this[this.length - 1];
}
}
@krogla
krogla / index.ts
Created Apr 29, 2020 — forked from Curtis017/index.ts
Simple middleware implementation using typescript and ES6
View index.ts
import pipeline, { Middleware } from './pipeline';
const step1: Middleware<any, any> = (req, res, next) => {
if (req.body) {
console.log(`STEP 1: \n req: ${JSON.stringify(req)}\n res: ${JSON.stringify(res)}`);
next();
}
}
const step2: Middleware<any, any> = async (req, res, next) => {
@krogla
krogla / client.js
Created Oct 4, 2019 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
View client.js
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@krogla
krogla / remove.js
Last active Mar 7, 2018
remove unused contracts from Mist
View remove.js
//rename unused contracts to '--' and run script
CustomContracts.find().fetch().map(
function(m) { if (m.name == '--') {CustomContracts.remove(m._id);}}
)
View mist_cleanup.js
//Remove contracts by ID
CustomContracts.find().fetch();
CustomContracts.remove("_CONTRACT_ID_");
//Remove tokens by ID
Tokens.find().fetch();
Tokens.remove("_TOKEN_ID_");
//Remove all contracts
CustomContracts.find().fetch().map(
@krogla
krogla / QueueRetryAllCommand.php
Created Nov 14, 2017 — forked from JacobBennett/QueueRetryAllCommand.php
Laravel Queue:Retry-Multiple and Queue:Retry-All
View QueueRetryAllCommand.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class RetryAllCommand extends Command
{
/**
* The name and signature of the console command.
View faucet.rinkeby.io
0xdEd06033526BA77D5eDBBaab141D2ab4bb0e1409
You can’t perform that action at this time.