Skip to content

Instantly share code, notes, and snippets.

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Tue May 31 17:10:47 2016 from xx.xxx.xx.xxx
]0;root@tmp: ~root@tmp:~# ssh dokku
ubuntu@dokku's password:
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)
* Documentation: https://help.ubuntu.com/
@finwo
finwo / chained.js
Last active October 26, 2016 13:22
Simple function chaining library.
(function(exports) {
function Chained(callback) {
// Some vars we'll use
var chain = [],
self = this,
ran = false;
// Adding more callbacks
define('autocomplete', ['jquery'], function($) {
return function(selector) {
$(selector).each(function() {
var $element = $(this),
source = $element.data('autocomplete'),
cache = {};
$element.attr('autocomplete', 'off');
$element.typeahead({
source : function(query, done) {
if (cache[query]) {
if (typeof define === 'function' && define.amd) {
define('persistent-input', ['jquery', 'localstorage'], function($, localstorage) {
var registeredInputs = {};
var cachedData = {};
/**
* @params {string} key[, {string} value]
* @returns {null}
*/
Welcome to Linux Mint 18 Sarah (GNU/Linux 4.4.0-65-generic x86_64)
* Documentation: https://www.linuxmint.com
No mail.
Last login: Mon Mar 6 16:51:53 2017 from 127.0.0.1
finwo:~% cd git/jsonmapper-issue-72
finwo:jsonmapper-issue-72% phpbrew use 5.3.29
finwo:jsonmapper-issue-72% cat composer.json
{
"name": "ratus/promotools",

Cryptography ideas

Mainly based upon the verification step in IBAN, a.k.a. multi-step modulus

Simplest form

*256 mod key

KEY : 22709
@finwo
finwo / ajax.js
Last active April 20, 2018 13:21
(function(exports) {
var factories = [
function () {return new XMLHttpRequest()},
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];
function httpObject() {

Keybase proof

I hereby claim:

  • I am finwo on github.
  • I am finwo (https://keybase.io/finwo) on keybase.
  • I have a public key ASAoZ5gH2JdfuxuLs_OI-vR7Sup9zKW7UCCIXin3igXemwo

To claim this, I am signing this object:

@finwo
finwo / cache.js
Created August 5, 2023 21:37
Caching thingymagic
const app = require('express')();
const fetch = require('node-fetch');
const port = parseInt(process.env.PORT || '8080');
const cache = {};
app.get('/:packageName', async function(req, res) {
const now = Date.now();
if (cache[req.params.packageName] && (cache[req.params.packageName].exp > now)) {