This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function importGUN3 (data, options){ | |
options = options || {}; | |
options.prefix = 'gun/'; | |
if(options.arrays !== false){ | |
options.arrays = true; | |
data = array2object(data); | |
} | |
var drift = options.state || Gun.time.now(); | |
var ctx = {}, at = {}; | |
Gun.ify(data, function(env, cb, map){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const fs = require('fs'); | |
const tape = require('tape'); | |
const _test = require('tape-promise').default // <---- notice 'default' | |
const test = _test(tape) // decorate tape | |
const Gun = require('../gun') | |
require('../gun/sea') | |
require('../gun/lib/then.js') | |
require('../gun/lib/promise.js') | |
const mkdirp = require('mkdirp'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get and put encrypted and/or signed material to paths in Gun | |
* FIXME: Investigate why root level put doesn't work | |
* | |
* DONE: Add signing to make objects unwritable by others | |
* Changes: | |
* - 25.02.2020 | |
* - added mergedeep to better merge deeper objects between themselves | |
* - added pair.osign option to only sign not encrypt when passing existing pairs | |
**/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*so let's simplify you have | |
- your letters (all messages, yours & other peer) which you draw to DOM | |
- you have your outbox , when you say something, that the other person listens to with .on(...) | |
and adds to their letters when they arrive | |
- you listen with .on(...) the other peers messages and add them to letters when | |
they arrive | |
- on your send(){...} you would add the message to your letters | |
and to the outbox so your message can trigger the other persons .on */ | |
class Chat { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
this.Promise = new Class({ | |
Implements: Class.Thenable, | |
initialize: function(promise) { | |
if (typeof promise !== 'function') | |
throw new TypeError('Promise accepts only a function constructor!'); | |
try { | |
promise(this.resolve.bind(this), this.reject.bind(this)); | |
} catch (e) { | |
this.reject(e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var validator = module.exports = { | |
isDecimal : function(input) { return (/^(?=.)\d*(\.\d{1,9})?$/.test(input)); }, | |
isNull : function(input) { return ((input == null) || (typeof input === "string" && input.replace(/\s/g, "") == "") || (typeof input === "undefined") || (input.length == 0)); }, | |
isAlpha : function(input) { return (/^[a-zA-Z]+$/.test(input) && !validator.isNull(input)); }, | |
isAlphanumeric : function(input) { return !(/\WöäåÖÄÅ/.test(input)); }, | |
isNumeric : function(input) { return (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/.test(input)); }, | |
isEmail : function(input) { return (!validator.isNull() || (/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+\/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(input)); } | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Auto renewal script for letsencrypt | |
# https://disinclined.org/share/renew-ssl-certificates.sh.txt | |
# this script is for singular domain-named files in /etc/nginx/sites-enabled, so check paths to match and enjoy | |
# Created by majuscule @ #letsencrypt on freenode ( [email protected] ) | |
ERROR=0 | |
for DOMAIN in $(ls -1 /etc/nginx/sites-enabled); do | |
/root/letsencrypt/letsencrypt-auto certonly \ | |
--server 'https://acme-v01.api.letsencrypt.org/directory' \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
--- | |
script: Date.Finnish.js | |
name: Date.Finnish | |
description: Date messages for Finnish language. | |
license: MIT-style license |