Skip to content

Instantly share code, notes, and snippets.

View laurentsenta's full-sized avatar
🌱

Laurent Senta laurentsenta

🌱
View GitHub Profile
@laurentsenta
laurentsenta / package.json
Created November 2, 2018 09:39
React fix Electron and relative path
{
...
"homepage": "./",
...
}
@laurentsenta
laurentsenta / electron.js
Created November 2, 2018 09:35
With electron-is-dev
// https://gist.github.com/lsenta/36fa6d913dffa1d3218d212e0067056f#file-electron-js
...
const isDev = require("electron-is-dev")
...
function createWindow() {
...
if (isDev) {
// connect to create-react-app dev server
@laurentsenta
laurentsenta / fresh-chrome-with-custom-tz.sh
Created October 31, 2018 09:53 — forked from prasadsilva/fresh-chrome-with-custom-tz.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, user config and custom Timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@laurentsenta
laurentsenta / electron.js
Created September 23, 2018 15:12
Electron + create-react-app setup
const {app, BrowserWindow} = require("electron")
const path = require("path")
const isDev = require("electron-is-dev")
let mainWindow // prevent main windows to be garbage collected
function createWindow() {
mainWindow = new BrowserWindow({
frame: false,
width: 226,
@laurentsenta
laurentsenta / config_paths.js
Last active January 5, 2018 15:50
create-react-app chrome quickstart
module.exports = {
...
newtabHtml: resolveApp('public/newtab.html'),
popupHtml: resolveApp('public/popup.html'),
newtabJs: resolveApp('src/newtab.js'),
popupJs: resolveApp('src/popup.js'),
...
};
@laurentsenta
laurentsenta / test.sol
Created December 9, 2017 14:55
Data Storage Test Excerpts
pragma solidity ^0.4.0;
contract Test {
mapping(uint =\> uint) tests;
function Test() {
}
function one_set() {
tests[0] = 0;
@laurentsenta
laurentsenta / voter.sol
Created December 9, 2017 14:54
Solidity Code Voter Demonstration
'' Solidity Code (solidity.readthedocs.io)
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}

Keybase proof

I hereby claim:

  • I am lsenta on github.
  • I am lsenta (https://keybase.io/lsenta) on keybase.
  • I have a public key ASAxFII1AzQqnwDFRwGLrBlqpWfg777Uc5GBC0SAhfnubgo

To claim this, I am signing this object:

@laurentsenta
laurentsenta / blockchain_add.py
Created October 9, 2017 09:43
SingularGarden - How to implement a Blockchain - Add
# https://github.com/singulargarden/ouroboros/blob/v0.1/ouroboros/blockchain/__init__.py
def add(root_path, proposed_block_hash, payload):
"""
Make sure we agree on the proposed hash add the block to our chain.
Use this when a block comes from an external source.
"""
new_descr, block = prepare_block(root_path, payload)
# Identical to append but we verify the hash!
@laurentsenta
laurentsenta / blockchain_append.py
Last active October 11, 2017 07:39
SingularGarden - How to implement a Blockchain - Append
# https://github.com/singulargarden/ouroboros/blob/v0.1/ouroboros/blockchain/__init__.py
def prepare_block(root_path, payload):
# Load the current blockchain state
current_descr = load_descr(root_path)
# Create the new block attached to the current head of the chain
current_block_hash = current_descr.head_hash
new_block = make_block(current_block_hash, payload)