Skip to content

Instantly share code, notes, and snippets.

View iamchrissmith's full-sized avatar

Chris Smith iamchrissmith

  • Earth
View GitHub Profile
@iamchrissmith
iamchrissmith / delegatecall.md
Created April 1, 2019 20:08
Understanding msg.sender with delegatecall

To evaluate the value of msg.sender when using solidity/assembly's delegatecall:

We start out with 3 contracts:

pragma solidity ^0.5.7;

contract ScratchPadActions {
    event SenderActions(address contractAddress, address sender, address second);
    function relay(ScratchPad2 second) public returns (address) { 
        emit SenderActions(address(this), msg.sender, address(second));
@iamchrissmith
iamchrissmith / prework.md
Created January 4, 2017 17:30 — forked from mbburch/prework.md
An example template for your Turing pre-work Gist

Turing School Prework

Task A- Practice Typing:

  • screenshots of scores will be posted in comments

Task B- Algorithmic Thinking & Logic:

  • screenshots of completed sections will be posted in comments

Task C- Create your Gist:

@iamchrissmith
iamchrissmith / WooCommerce Coupon Count Correction
Last active April 15, 2020 16:15
Two functions to change the way WooCommerce counts coupon usage so Product coupons are counted each time they are applied not once per cart.
function crc_woocommerce_display_coupons(){
global $wpdb;
$coupon_id = $wpdb->get_results(
$wpdb->prepare(
"
SELECT ID FROM $wpdb->posts
WHERE post_type = %s
AND post_status = 'publish'
",
'shop_coupon'
SPEC ERROR: /Users/chrissmith/Projects/k-ds-guard/out/specs/617021af8de987b5d4f7d2a2afac1a72fd17c33b75cdc5f1440117d544b77a8e.k Location(12,3,180,36)
==================================
Success execution paths: 0
Failed execution paths: 1
Paths in progress: 1
Longest path: 131 steps
Stats for each phase, time, used memory, implicit main GC time percentage:
Total                 :  218.558 s,	  541 MB, gc:  0.649 %
  Parsing             :  206.018 s,	  135 MB, gc:  0.610 %

SETH Examples

Setup

Need .sethrc for the blockchain you want to connect to. For this demo we'll be using dapp testnet and the setup-testnet.sh script from icetan. This script gets and sets some env variables for us:

  • ETH_FROM
  • ETH_PASSWORD
  • ETH_KEYSTORE
  • ETH_RPC_URL
### Keybase proof
I hereby claim:
* I am iamchrissmith on github.
* I am iamchrissmith (https://keybase.io/iamchrissmith) on keybase.
* I have a public key ASBEY_D0Rw2H43GFLUTnzqD-st2amXuR4ph-PtMLgMVeTAo
To claim this, I am signing this object:
@iamchrissmith
iamchrissmith / pd_pre-work.md
Last active March 7, 2017 14:57
Pre-work on Professional development

Directions:

For the activities listed below, please create a gist on GitHub to capture your reflections for each of these 3 parts.

  1. Read through this post from Red Pill Programming to get a sense of the different mindsets you'll want to consider in your new career: The Software Engineer Framework: 8 Ways to Become a Better Software Engineer.

    • Approximate reading time: 15 minutes
    • After reading, please write a reflection (4-6 sentences) on your takeaways from the post.
  2. Mentioned in the first reading, the idea of a strong checklist is the focus in the second reading. Read through and/or listen to this interview with Atul Gawande (author of the Checklist Manifesto). It includes an excerpt from his book, which is optional reading.

@iamchrissmith
iamchrissmith / gist:e82b31603a1fbfb78e4f
Created March 2, 2015 05:07
Escape Button - Link to Google
<a href='https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&sqi=2&ved=0CB4QFjAA&url=http%3A%2F%2Fwww.google.com%2F&ei=8e3zVKuCL4-zyATQ04HYCQ&usg=AFQjCNG5-9Jej-ukVeakTgwonqt2narbYg&bvm=bv.87269000,d.aWw'>ESCAPE</a>