Skip to content

Instantly share code, notes, and snippets.

Steps

execute geth in dev mode (install via brew install ethereum, version 1.8.11):

$ geth --rpc --rpcaddr 0.0.0.0 --rpcport 7878 --dev

truffle init:

const fetch = require('isomorphic-fetch');
const toml = require('toml');
async function getLine(package) {
const [owner, repo] = package.name.split('/').slice(-2);
try {
const licenseApiUrl = `https://api.github.com/repos/${owner}/${repo}/license`;
const options = {
headers: {
'Authorization': 'token <YOUR_GITHUB_PERSONAL_TOKEN>'
pragma solidity ^0.4.17;
contract MeetupEvent {
string public title;
uint public limit;
uint userAmount;
mapping (address => uint256) public attendees;
constructor(string _title, uint _limit) public {
title = _title;
import java.util.ArrayList;
public class MeetupEvent {
private String title;
private int limit;
private ArrayList<String> attendees;
public MeetupEvent(String title, int limit) {
this.title = title;
this.limit = limit;
class MeetupEvent {
constructor(title, limit) {
this.title = title;
this.limit = limit
this.attendees = [];
}
register(member) {
if (this.attendees.length < limit) {
this.attendees.push(member);
function create() {
const MEETUP_SCHEDULE = 'Meetup Schedule';
const TALKS = 'talks';
const TITLE_INDEX = 2;
const ABSTRACT_INDEX = 3;
const SPEAKER_INDEX = 4;
const SPEAKER_INTRO_INDEX = 5;
const SLIDES_INDEX = 6;
const LANGUAGE_INDEX = 7;
const RECORD_INDEX = 8;
0x00c15a817C820827DE719467B5f13008F1387a45
0x00A799936d0Ee0249D8a86d0C6234C8040c5bA87
// 一個月薪 25000 男性,今天剛上班的勞工,在平常日從八點工作十一個小時
// 他的加班費應該為 451 元
const labor = new Labor()
labor.setAge(20)
.setGender(Gender.MALE)
.onBoard(new Date())
.setMonthlySalary(25000)
const worktime = new WorkTime(Duration.DAY, labor)
const start = new Date(2017, 6, 5, 8)
worktime.add(start, 11)
@yurenju
yurenju / Dice.feature
Last active July 14, 2017 07:18
骰子
#language: zh-TW
功能: 擲骰子
場景: 擲一顆骰子
當按下 "擲" 按鈕
那麼骰子會顯示 1 - 6 之間的點數
場景: 擲兩顆骰子
當改變骰子數量變成 2 時