Skip to content

Instantly share code, notes, and snippets.

@kennethhutw
kennethhutw / leaflet-google.js
Last active February 11, 2016 05:38 — forked from crofty/leaflet-google.js
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
@kennethhutw
kennethhutw / Javascript: HTML to text
Created March 14, 2016 08:13
converts HTML to text using Javascript
// converts HTML to text using Javascript
function html2text(html) {
var tag = document.createElement('div');
tag.innerHTML = html;
return tag.innerText;
}
@kennethhutw
kennethhutw / coinbase.txt
Last active October 10, 2017 05:56
rinkeby coinbase
0xDfA0D77901ea0F39E8B57A430b92D08d0656643b
0x73F2662412C20dAaB7081D935B81575B14Ae6e81
@kennethhutw
kennethhutw / gist:ae299e3ad46da2a0f0e974846d04a168
Created July 19, 2018 09:13
Ethereum UTC / JSON Encrypted Wallet - Example
{
"id": "9a35ca65-65a2-9cfe-c468-4d31cab24a9a",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "c4c381cc5325fcbf2e50efadc81da84e"
},
"ciphertext": "1aa9e3937902cb7bd0736cd67c33a4a2035e671d5ac2a43bc17b8b3202fa7a40",
"kdf": "pbkdf2",
@kennethhutw
kennethhutw / basic solidity 1
Created July 20, 2018 19:23
basic solidity
Solidity lets you program on Ethereum, a blockchain-based virtual machine that allows the creation and execution of smart contracts, without needing centralized or trusted parties.
Solidity is a statically typed, contract programming language that has similarities to Javascript and C. Like objects in OOP, each contract contains state variables, functions, and common data types. Contract-specific features include modifier (guard) clauses, event notifiers for listeners, and custom global variables.
Some Ethereum contract examples include crowdfunding, voting, and blind auctions.
As Solidity and Ethereum are under active development, experimental or beta features are explicitly marked, and subject to change. Pull requests welcome.
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
import { Injectable } from '@angular/core';
import { AngularFireDatabaseModule, AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import { Router } from "@angular/router";
import * as firebase from 'firebase';
@Injectable()
export class AuthService {
const EthWallet = require('ethereumjs-wallet')
const HDKey = require('ethereumjs-wallet/hdkey')
const bip39 = require('bip39')
// Generate mnemonic and seed
const mnemonic = bip39.generateMnemonic()
const seed = bip39.mnemonicToSeed(mnemonic)
console.log(`generated mnemonic:\n\t${mnemonic}\n`)
// Wallet from seed and get the public Extended key
@kennethhutw
kennethhutw / app.json
Last active December 13, 2018 02:37
eth-net-intelligence-api default configurations
[
{
"name" : "node-app",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : false,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
@kennethhutw
kennethhutw / app.json
Created December 13, 2018 02:40
eth-net-intelligence-api configuration
[
{
"name" : "node-app",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : false,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",