Skip to content

Instantly share code, notes, and snippets.

View michal-wrzosek's full-sized avatar
🇳🇱
Coding from Rotterdam

Michał Wrzosek michal-wrzosek

🇳🇱
Coding from Rotterdam
View GitHub Profile
@michal-wrzosek
michal-wrzosek / binary-sparse-merkle-tree-32-levels-update-proof.zok
Last active November 17, 2021 12:10
Binary Sparse Merkle Tree Update Proof (Proof of new digest) (32 levels -> max ~4mld leafs) (Zokrates Zero-Knowledge Proof)
import "hashes/poseidon/poseidon" as poseidon
const u32[32] powers_of_two = [
1,
2,
4,
8,
16,
32,
64,
@michal-wrzosek
michal-wrzosek / binary-sparse-merkle-tree-32-levels-proof.zok
Last active November 16, 2022 01:13
Binary Sparse Merkle Tree Proof (32 levels -> max ~4mld leafs) (Zokrates Zero-Knowledge Proof)
import "hashes/poseidon/poseidon" as poseidon
const u32[32] powers_of_two = [
1,
2,
4,
8,
16,
32,
64,
function cntl(template: TemplateStringsArray, ...templateElements: any[]) {
return template
.reduce((sum, n, index) => {
const templateElement = templateElements[index];
if (typeof templateElement === 'string') {
return `${sum}${n}${templateElement}`;
}
return `${sum}${n}`;
}, '')
.trim()
import React from 'react';
import cntl from 'cntl';
const buttonCN = ({ isRed }: { isRed: boolean }) => cntl`
hover:bg-blue-700
text-white
font-bold
py-2
px-4
rounded
import React from 'react';
import cntl from 'cntl';
const wrapperCN = cntl`
max-w-sm
rounded
overflow-hidden
shadow-lg
`;
import React from 'react';
import cntl from 'cntl';
const Card = () => (
<div className="max-w-sm rounded overflow-hidden shadow-lg">
<img className="w-full" src="/img/card-top.jpg" alt="Sunset in the mountains" />
<div className="px-6 py-4">
<div className="font-bold text-xl mb-2">The Coldest Sunset</div>
<p className="text-gray-700 text-base">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus quia, nulla! Maiores et perferendis
@michal-wrzosek
michal-wrzosek / api.Dockerfile
Created December 3, 2019 02:05
yarn workspaces and Docker
FROM node:10-alpine as build
WORKDIR /usr/src/app
COPY package.json .
COPY yarn.lock .
COPY packages/shared ./packages/shared
COPY packages/api ./packages/api
RUN yarn install --pure-lockfile --non-interactive
@michal-wrzosek
michal-wrzosek / _app.tsx
Created November 21, 2019 19:58
Next.js + Apollo - _app page
import React from 'react';
import App from 'next/app';
import { ApolloProvider } from '@apollo/react-hooks';
import { ApolloClient } from 'apollo-boost';
import getConfig from 'next/config';
import withApollo from 'src/lib/withApollo';
import { GlobalStyles } from 'src/styles/GlobalStyles';
const { publicRuntimeConfig } = getConfig();
@michal-wrzosek
michal-wrzosek / withApollo.tsx
Created November 21, 2019 19:54
Next.js + Apollo - withApollo
import withApollo from 'next-with-apollo';
import ApolloClient, { InMemoryCache } from 'apollo-boost';
export default (uri: string) =>
withApollo(
props =>
new ApolloClient({
uri,
cache: new InMemoryCache().restore(props.initialState || {}),
credentials: 'include',
@michal-wrzosek
michal-wrzosek / tsconfig.json
Created September 18, 2019 20:21
Create React App Boilerplate - ./tsconfig.json (baseUrl option)
{
"compilerOptions": {
"baseUrl": "src"
}
}