Skip to content

Instantly share code, notes, and snippets.

View kcole16's full-sized avatar

Kendall Cole kcole16

  • HawkHire
  • United States
View GitHub Profile
@kcole16
kcole16 / near-drop.md
Last active August 4, 2020 18:36
Funding a NEAR Drop

Funding a NEAR Drop

Follow these steps to fund a NEAR Drop for a user:

  1. Instantiate a near-api-js connection
const { connect, KeyPair } = require('nearlib');
const near = await connect({
        deps: { keyStore },
@kcole16
kcole16 / gist:6787398822754cc1f8ee4f08a1e566f5
Created December 14, 2018 16:44
Uniswap Solidity Interfaces
pragma solidity ^0.5.1;
contract Factory {
function createExchange(address token) public returns (address);
function getExchange(address token_addr) public view returns (address);
function getToken(address exchange) public view returns (address);
function getTokenWithId(uint256 token_id) public view returns (address);
}
pragma solidity ^0.4.0;
import "SafeMath.sol";
import "IERC20Token.sol";
/**
* @dev Implements a capped token sale using a second-price auction.
*
* @author Nick Johnson <[email protected]>
*
@kcole16
kcole16 / clojurebuzz
Created March 3, 2015 15:53
Clojure Fizzbuzz
(defn fizzbuzz [start end]
(map
#(if (and (= 0 (mod % 3))(= 0 (mod % 5))) "Fizzbuzz"
(if (= 0 (mod % 3)) "Fizz"
(if (= 0 (mod % 5)) "Buzz" %)))
(range start end)
)
)
@kcole16
kcole16 / Calculator.js
Created January 21, 2015 22:55
Simple React.js Calculator
<!DOCTYPE html>
<html>
<head>
<title>Calculator.js</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="http://fb.me/react-0.12.2.js"></script>
<script src="http://fb.me/JSXTransformer-0.12.2.js"></script>
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</head>
@kcole16
kcole16 / gist:2a8fbf7f065e5277c03d
Created August 6, 2014 02:06
Calculate QB Rating
def calculate_qbr(completions, pass_attempts, passing_yards, touchdowns, interceptions):
first_delta = ((float(completions)/pass_attempts) - 0.3)*5
if first_delta > 2.375:
first_delta = 2.375
elif first_delta < 0:
first_delta = 0
second_delta = ((float(passing_yards)/pass_attempts) - 3)*0.25
if second_delta > 2.375:
second_delta = 2.375