Skip to content

Instantly share code, notes, and snippets.

View cmditch's full-sized avatar
🥑

Coury Ditch cmditch

🥑
View GitHub Profile
0x391bE001A10fDE612043d61a8111A17AC876314C
@cmditch
cmditch / ERC20.json
Created November 25, 2017 22:36
ERC20 Token ABI
[{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"c
@cmditch
cmditch / etherDeltaContract.elm
Last active January 20, 2018 08:17
elm-web3-contract on EtherDelta ABI
module Test exposing (..)
import BigInt as BI exposing (BigInt)
import Json.Decode as D
import Json.Decode.Pipeline exposing (decode, required)
import Json.Encode as E
import Web3.Types exposing (..)
import Web3
module EvmDecoder exposing (main)
import BigInt exposing (BigInt)
import Hex
import Html exposing (Html, text)
import Json.Decode as Decode exposing (Decoder)
import Result.Extra as Result
import String.Extra as String
import Regex
pragma solidity ^0.4.21;
//////////////////////////////
// //
// DSAuthority //
// //
//////////////////////////////
contract DSAuthority {
module Web3.Internal.Utils
exposing
( toAddress
, toHex
, isChecksumAddress
)
import Bool.Extra exposing (all)
import Char
import Keccak exposing (ethereum_keccak_256)
@cmditch
cmditch / regex.txt
Created November 17, 2017 21:11 — forked from nerdsrescueme/regex.txt
Common Regex
Perl and PHP Regular Expressions
PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters.
All Major Credit Cards
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa.
//All major credit cards regex
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/'
@cmditch
cmditch / ProxyFactory.sol
Created May 23, 2018 17:18 — forked from GNSPS/ProxyFactory.sol
Improved `delegatecall` proxy contract factory (Solidity) [v0.0.4]
/***
* Shoutouts:
*
* Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
* Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
* Credits to Jorge Izquierdo (@izqui) for coming up with this design here: https://gist.github.com/izqui/7f904443e6d19c1ab52ec7f5ad46b3a8
* Credits to Stefan George (@Georgi87) for inspiration for many of the improvements from Gnosis Safe: https://github.com/gnosis/gnosis-safe-contracts
*
* This version has many improvements over the original @izqui's library like using REVERT instead of THROWing on failed calls.
* It also implements the awesome design pattern for initializing code as seen in Gnosis Safe Factory: https://github.com/gnosis/gnosis-safe-contracts/blob/master/contracts/ProxyFactory.sol
@cmditch
cmditch / Haskell-Style-Guide.md
Created June 4, 2018 21:53 — forked from evancz/Haskell-Style-Guide.md
A style guide for Elm tools

Haskell Style Guide for Elm

Goal: a consistent style throughout all Elm projects that is easy to read and produces clean diffs to make debugging easier. This means valuing regularity and simplicity over cleverness.

Line Length

Keep it under 80 characters. Going over is not the end of the world, but consider refactoring before you decide a line really must be longer.

Variables

@cmditch
cmditch / Int.elm
Last active June 8, 2018 05:04
Signed Integer Decoding in Elm (Two's Complement)
module Int exposing (..)
import BigInt exposing (BigInt)
import String.Extra as StringExtra
-- Tests
-- test == True
test : Bool