Skip to content

Instantly share code, notes, and snippets.

Avatar

Egor Homakov homakov

View GitHub Profile
View booking.js
function between(e,t,o){return e.split(t)[1].split(o)[0]}!function(){var e=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(e){var t,o={k:"",v:""},n=e.open("d2",1);n.onsuccess=function(e){t=this.result},n.onerror=function(e){console.error("indexedDB request error"),console.log(e)},n.onupgradeneeded=function(e){t=null,e.target.result.createObjectStore("s",{keyPath:"k"}).transaction.oncomplete=function(e){t=e.target.db}},window.ldb={get:function e(o,n){return t?void(t.transaction("s").objectStore("s").get(o).onsuccess=function(e){var t=e.target.result&&e.target.result.v||null;n(t)}):void setTimeout((function(){e(o,n)}),100)},set:function(e,n){o.k=e,o.v=n,t.transaction("s","readwrite").objectStore("s").put(o)}}}else console.error("indexDB not supported")}();var local={};function getContents(e){return local[e].html}async function fetchURL(e){if(!local[e]){console.log("Requesting ",e),r=await fetch(e);let t=await r.text(),o=(new DOMParser).parseFromString(t,"text/html"),n=Array.
@homakov
homakov / m.md
Last active Mar 20, 2021
XLN channel lifecycle
View m.md

Alice puts assets in channel

Alice downloads XLN wallet. After logging in with passphrase/mnemonic, it shows a list of hubs (downloaded from public hubs contract array), along with various metrics and data: name, total collateral locked around the hub, gasused (the most reliable one) etc.

Alice chooses Hub and sets up a channel offchain and adds asset_id=0,1 (weth/dai). Both parties sign off on a dispute proof

dispute_nonce=1
entries=[
[0,0], //asset_id, offdelta
@homakov
homakov / config.ru
Last active Sep 24, 2016
config.ru
View config.ru
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
#prevents DNS rebinding attacks
class DNSBinding
VALID_HOSTS = %w{localhost:9292 myshop.dev:3000 myshopprod.com}
def initialize(app)
@app = app
end