Skip to content

Instantly share code, notes, and snippets.

View xpepermint's full-sized avatar
💭
Developing the future

Kristijan Sedlak xpepermint

💭
Developing the future
View GitHub Profile
@xpepermint
xpepermint / index.ts
Created August 13, 2018 08:04
Merkle tree implementation
/**
* Converts a list of values into a list of pairs.
* @param arr Single dimensional array of values.
*/
function toPairs(arr) {
return Array.from(Array(Math.ceil(arr.length / 2)), (_, i) => arr.slice(i * 2, i * 2 + 2));
}
/**
* Converts a list of values into a list of pairs.
@xpepermint
xpepermint / Command
Created July 19, 2018 19:12
MongoDB setup using Docker
docker run -d \
--name mongo \
-p 27017:27017 \
-v ~/.docker/machine/volumes/mongo/4/data:/data/db \
mongo:4
@xpepermint
xpepermint / facts.md
Last active April 3, 2018 07:45
0xcert protocol specification

Whitepaper: https://0xcert.org/whitepaper.pdf

Non-fungible Token

  • A unique, one-of-a-kind asset.
  • A digital asset like a collectible, a document or a thing.
  • Follows ERC721 specification.

Xcert

@xpepermint
xpepermint / index.js
Created September 30, 2017 16:47
Using RawModel in ExpressJS actions.
const { Model } = require("rawmodel");
const express = require("express");
/** Application context *******************************************************/
class Context {
constructor() {
this.db; // imaginary database
}
connect() {
@xpepermint
xpepermint / pre-post
Last active November 28, 2016 09:10
git `.git/hooks/pre-post` to commite bundles into `production` branch
```
#!/bin/sh
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
if [ "master" != "$branch" ]; then
exit;
fi
git checkout production
@xpepermint
xpepermint / webpack.config.js
Last active October 27, 2022 06:12
Vue.js webpack.config.js
var path = require('path');
var webpack = require('webpack');
var isProduction = process.env.NODE_ENV === 'production';
/*
* Compile for usage in a browser-like environmen or for the server.
*/
exports.target = 'web';
1. Build GraphQL server using `express-graphql` package.
2. Configure `schema.js` file.
3. Query for data.
@xpepermint
xpepermint / webpack.config.js
Last active April 20, 2021 07:04
Webpack Common Configuration File (ReactJS)
'use strict';
/**
* Webpack Configuration File
*
* This is a configuration file for Webpack module bundler. You should customize
* it to fit your project.
*
* To start the development server run:
*