Skip to content

Instantly share code, notes, and snippets.

@davidjguru
davidjguru / Blocks.md
Created November 12, 2020 17:47 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@chris-belcher
chris-belcher / coinswap-design.md
Last active April 26, 2024 04:37
Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

25/5/2020

Abstract

Imagine a future where a user Alice has bitcoins and wants to send them with maximal privacy, so she creates a special kind of transaction. For anyone looking at the blockchain her transaction appears completely normal with her coins seemingly going from address A to address B. But in reality her coins end up in address Z which is entirely unconnected to either A or B.

Now imagine another user, Carol, who isn't too bothered by privacy and sends her bitcoin using a regular wallet which exists today. But because Carol's transaction looks exactly the same as Alice's, anybody analyzing the blockchain must now deal with the possibility that Carol's transaction actually sent her coins to a totally unconnected address. So Carol's privacy is improved even though she didn't change her behaviour, and perhaps had never even heard of this software.

v3.0.0 v3.1.0 v3.1.1 master
v3.0.0 Y
v3.1.0 X
v3.1.1 X
master X X X X

Scriptless Script for DLC

Scriptless Script

Assumptions

pk_script
<witness version 0x0X> <public key / EC point : P >

@QuentinFonteneau
QuentinFonteneau / flush-image-style.php
Created January 19, 2018 13:26
Flush all image styles in Drupal 8
$imageStyle = \Drupal::entityTypeManager()->getStorage('image_style');
$styles = $imageStyle->loadMultiple();
foreach ($styles as $style) {
$imageStyle->load($style->get('name'))->flush();
}
@iammerrick
iammerrick / PinchZoomPan.js
Last active April 22, 2024 02:54
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@johnyzed
johnyzed / alter_global_param.groovy
Created June 9, 2015 05:14
alter jenkins global parameter
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
nodes = Jenkins.getInstance().getGlobalNodeProperties()
@davecgh
davecgh / example_txscript_signaturescript.go
Last active September 20, 2018 19:45
Example of signing a transaction using txscript.SignatureScript
package main
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@jointhepartypooper
jointhepartypooper / gist:5fa889e9e6e7fb6b6d5b
Last active December 1, 2015 17:26
hookGetFindstakeData
var http = require('http');
function checkTxPresent(txId, txIndex, cb) {
var keytx = 'to' + txId + '_' + txIndex;
var str = '';
var fileurl = "http://peercoinfindstakedata.divshot.io/json/" + keytx + '.json';
var handleRes = function (res) {
var isOK = (res.statusCode == 200);
res.on('data', function (chunk) {
@kac-
kac- / blind_oleg.go
Last active April 10, 2024 09:59
Blind signatures for Bitcoin transactions
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/sha256"
"fmt"
"math/big"
)