Skip to content

Instantly share code, notes, and snippets.

@risingnote
risingnote / workshop_voting.mpc
Created March 31, 2017 08:04
TPMPC SPDZ MPC Voting Program
"""
Receive a share of votes for between 1 and 3 workshop talks, store in the
voter history (voter id, talk id * 3) and votes count (talk id, points total).
The voter history supports a voter recasting their votes.
The votes count supports calculating the top 3 talks which are revealed and
returned to the managmeent server.
At startup the management server (verified by public key) sends a list of shares
of valid voter ids and talk ids. The program is limited to a fixed array size of
voter ids and talk ids, with unused slots set to zero.
@risingnote
risingnote / Setup.js
Created January 23, 2017 10:36
Use Jest and react test renderer for snap shot tests, including simulated click events.
/**
* Responsible for displaying setup information based on props passed in.
*/
import React from 'react';
import { List } from 'immutable'
import ProxyStatus from './ProxyStatus'
import './Setup.css'
const Setup = (props) => {
const proxyServers = (proxyServerList) => {
@risingnote
risingnote / jsconfig-node.json
Created December 16, 2016 17:07
vscode jsconfig examples
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules",
"bower_components",
"jspm_packages",
@risingnote
risingnote / jest-suppertest.js
Last active September 25, 2017 16:39
Use Jest (Jasmine) and supertest to test REST API.
// Need to run test async and use jest/jasmine done.fail to let it know when an assertion did not work.
const routerUnderTest = require('../../client_api')
const httptest = require('supertest')
const express = require('express')
const app = express()
app.use('/', routerUnderTest)
describe('I can use the REST api', () => {
it('displays text for the landing page', (done) => {
@risingnote
risingnote / launch.json
Last active November 15, 2016 22:12
Setup Visual Studio Code with a debug config to run a Jest test. Select the test in an editor and run the debug task.
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "JEST Test",
"type": "node",
"request": "launch",