Skip to content

Instantly share code, notes, and snippets.

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.

Abstract

The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.

@DimitrK
DimitrK / carryOperationsCounter.js
Last active November 14, 2021 00:09
Counts the number of carry operation in an addition of two numbers
function numberOfCarryOperations(x,y) {
var xs = x.toString();
var ys = y.toString();
var cary = 0;
var operations=0;
var xCurrent;
var yCurrent;
while (xs.substr(xs.length-1) || ys.substr(ys.length-1) ) {
yCurrent =ys.substr(ys.length-1);
@eveningkid
eveningkid / react-native-shared-elements_facebook-marketplace.jsx
Created March 24, 2021 10:22
React Native Shared Elements: Facebook Marketplace Example
// Expo SDK40
// @react-native-community/masked-view: 0.1.10
// @react-navigation/native: ^5.9.3
// @react-navigation/stack: ^5.14.3
// react-native-gesture-handler: ~1.8.0
// react-native-reanimated: ~1.13.0
// react-native-safe-area-context: 3.1.9
// react-native-screens: ~2.15.2
// react-native-shared-element: 0.7.0
// react-navigation: 4
@intergalacticspacehighway
intergalacticspacehighway / PinchToZoom.tsx
Last active April 23, 2024 20:16
Pinch to zoom reanimated + gesture handler
import React, { useMemo, useState } from "react";
import { LayoutChangeEvent, StyleSheet } from "react-native";
import {
PinchGestureHandler,
PinchGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import Animated, {
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
@intergalacticspacehighway
intergalacticspacehighway / keyboard-aware-reanimated-scrollview.tsx
Last active March 17, 2023 12:13
keyboard aware reanimated scrollview
import React from "react";
import { Dimensions, TextInput, ScrollView } from "react-native";
import Animated, {
useAnimatedKeyboard,
useAnimatedReaction,
runOnJS,
KeyboardState,
useAnimatedProps,
useAnimatedScrollHandler,
@trvswgnr
trvswgnr / SyncService.test.ts
Last active August 7, 2023 07:31
daxxer challenge 2
import { SyncService } from './SyncService';
import type {
EventId,
UserId,
EventFromA,
} from './types';
import { describe, beforeEach, it, expect } from '@jest/globals';
import { QueueService, LogService, BService, MonitorService, CacheService } from './mock-services';