Skip to content

Instantly share code, notes, and snippets.

@michiakig
michiakig / ants.clj
Created July 19, 2011 22:37
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
@NicolasT
NicolasT / Primes.hs
Created August 1, 2011 14:14
Simple Haskell implementation of the Paillier homomorphic encryption scheme
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
-- Stuff taken from the RSA module for now
module Primes where
import Data.Bits
import Data.Int
import Data.Word
import Data.ByteString.Lazy (ByteString)
@katowulf
katowulf / 1_using_queries.js
Last active April 24, 2023 07:14
Methods to search for user accounts by email address in Firebase
/***************************************************
* Simple and elegant, no code complexity
* Disadvantages: Requires warming all data into server memory (could take a long time for MBs of data or millions of records)
* (This disadvantage should go away as we add optimizations to the core product)
***************************************************/
var fb = firebase.database.ref();
/**
* @param {string} emailAddress
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@rewonc
rewonc / app.js
Last active January 23, 2017 19:59
Authenticate a user with angularfire, save to firebase, and make available to controllers with promise
/*
This file is a brief example of how to use angularfire to authenticate a user, save that user's public profile to firebase, then
ensure that both the authenticated and public user are available in your controllers.
The route configuration uses angular-ui-router: https://github.com/angular-ui/ui-router
*/
@josephspurrier
josephspurrier / values_pointers.go
Last active April 28, 2024 16:41
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@jfairbank
jfairbank / fibonacci-generator.js
Last active December 4, 2023 12:23
Fibonacci ES6 Generator
function *fibonacci(n) {
const infinite = !n && n !== 0;
let current = 0;
let next = 1;
while (infinite || n--) {
yield current;
[current, next] = [next, current + next];
}
}
@stephantabor
stephantabor / bb.js
Last active January 6, 2024 04:18
Bluebird .each vs .mapSeries vs .map
var Promise = require('bluebird');
var funcs = Promise.resolve([500, 100, 400, 200].map((n) => makeWait(n)));
funcs
.each(iterator) // logs: 500, 100, 400, 200
.then(console.log) // logs: [ [Function], [Function], [Function], [Function] ]
funcs
.mapSeries(iterator) // logs: 500, 100, 400, 200

Resilience — RES with built-in dividend pathways and swarm redistribution, for decentralized basic income

The idea to use the global financial network of daily transactions, and to link these transactions together into a web, is a bit similar to Tim Berners Lee's idea to link all documents on the internet together with the Hypertext Transfer Protocol (HTTP), which gave us the world wide web. When Tim Berners Lee had the idea for the world wide web in the 80s, there were already documents on the internet. He did not have to invent the internet, and his contribution was instead that he saw a way to harness the information on the internet in a new way.

The same goes for the Resilience protocol. The world is electrified with millions, or billions, of financial transactions happening every single day. The global financial network is part of our infrastructure already. What Resilience aims to

@chrisdone
chrisdone / Origami.hs
Last active July 23, 2018 00:24
Origamic fold
-- | Fold over the input, folding left or right depending on the element.
origami :: (s -> l -> s) -> (r -> s -> s) -> s -> [Either l r] -> s
origami _ _ nil [] = nil
origami fl fr nil (x:xs) =
case x of
Left l -> origami fl fr (fl nil l) xs
Right r -> fr r (origami fl fr nil xs)