Skip to content

Instantly share code, notes, and snippets.

View zhangsoledad's full-sized avatar
🏠
Working from home

zhangsoledad zhangsoledad

🏠
Working from home
View GitHub Profile
@zhangsoledad
zhangsoledad / txt
Created July 13, 2017 13:50
zhangsoledad
0xe4c016a18617cc307d955ffbe003f0bd1ddc58e5
[package]
name = "rand"
version = "0.1.0"
authors = ["zhangsoledad <787953403@qq.com>"]
[dependencies.num-bigint]
git = "https://github.com/zhangsoledad/num-bigint"
features = ["rand"]
//This is a WeChat miniprogram client transport for phoenix.js
// so that you can use easily use Phoenix Channel as a WebSocket server.
// Written by @chrismccord
// example usage:
// ```
// let socket = new Socket("ws://localhost:4000/socket", { transport: WxSocket })
// socket.connect()
// let channel = socket.channel("room:lobby", {})
// channel.join()
// .receive("ok", resp => { console.log("Joined successfully", resp) })
@zhangsoledad
zhangsoledad / Hackathon.sol
Created June 29, 2018 04:00
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.0;
import "./Ownable.sol";
import "./SafeMath.sol";
contract HackathonFactory is Ownable {
address public owner;
event HackathonCreated(
address indexed _owner,
@zhangsoledad
zhangsoledad / Hackathon.sol
Created June 29, 2018 06:08
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity ^0.4.0;
import "./Ownable.sol";
import "./SafeMath.sol";
import "./State.sol";
contract HackathonFactory is Ownable {
address public owner;
event HackathonCreated(
@zhangsoledad
zhangsoledad / Hackathon.sol
Created June 29, 2018 08:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity ^0.4.0;
import "./Ownable.sol";
import "./SafeMath.sol";
import "./State.sol";
contract Hackathon is Ownable, HackathonState {
using SafeMath for uint256;
uint256 public initFound;
@zhangsoledad
zhangsoledad / Auth.sol
Created June 29, 2018 13:34
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&gist=
pragma solidity ^0.4.0;
contract Auth {
mapping(address => bytes32) internal verification;
function submit(bytes32 code) public {
verification[msg.sender] = code;
}
function getVerificationCode(address _person) public view returns (bytes32) {
@zhangsoledad
zhangsoledad / bechmark.md
Last active December 29, 2018 10:12
numext vs ethtypes
@zhangsoledad
zhangsoledad / writeup.md
Created October 25, 2019 07:31 — forked from edmundsmith/writeup.md
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type: