Skip to content

Instantly share code, notes, and snippets.

View jonchurch's full-sized avatar
♥️

Jon Church jonchurch

♥️
View GitHub Profile
@jonchurch
jonchurch / index.html
Created June 29, 2017 18:35 — forked from ColeTownsend/index.html
The Micro Stripe demo front end.
<!DOCTYPE html>
<html>
<head>
<title>Micro Stripe Checkout</title>
<meta charSet='utf-8' />
<meta name='viewport' content='initial-scale=1.0, width=device-width' />
<script src="https://js.stripe.com/v3/"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<style>
* {
@jonchurch
jonchurch / coin.sol
Last active December 23, 2017 10:47
Ethereum based coin contract from ethereum.com
pragma solidity ^0.4.8;
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract MyToken {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
@jonchurch
jonchurch / erc20token.sol
Last active November 21, 2022 16:00
ERC20 Sample Limted Supply Token
pragma solidity ^0.4.8;
// ----------------------------------------------------------------------------------------------
// Sample fixed supply token contract
// Enjoy. (c) BokkyPooBah 2017. The MIT Licence.
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Interface {
@jonchurch
jonchurch / asyncloops.js
Created July 22, 2017 18:41 — forked from lukehoban/asyncloops.js
Async/await and parallel loops
// ES6 w/ Promises
// Note: From a React starter template - see https://t.co/wkStq8y3I5
function fetchData(routes, params) {
let data = {};
return Promise.all(routes
.filter(route => route.handler.fetchData)
.map(route => {
return route.handler.fetchData(params).then(resp => {
data[route.name] = resp;
@jonchurch
jonchurch / todos.js
Last active July 24, 2017 17:44 — forked from julianburr/todos.js
Node script to list todos notes in code base
/**
* Author: Julian Burr <https://github.com/julianburr>
* License: https://creativecommons.org/publicdomain/zero/1.0/
*
* This script basically just runs through all source files and
* prints out a list of files and lines where it found the TODO
* keyword
*
* If you want to look for other keywords, just changed the
* searchRegEx to your needs :)
@jonchurch
jonchurch / gist:410f40becf7295445a375a7bf599f6b5
Last active September 6, 2017 07:30
Linux commands for disk space exploration
# list largest files in current dir by descending
du -ch -d 1 | sort -hr
# list files in a certain range
du -ch | grep '[0-5]G'
# common place to start
du -ch /home | grep '[0-9]G'
@jonchurch
jonchurch / printTodo.js
Created September 11, 2017 02:34
Print todos in dir
/**
* Author: Julian Burr <https://github.com/julianburr>
* License: https://creativecommons.org/publicdomain/zero/1.0/
*
* This script basically just runs through all source files and
* prints out a list of files and lines where it found the TODO
* keyword
*
* If you want to look for other keywords, just changed the
* searchRegEx to your needs :)
@jonchurch
jonchurch / ec2 setup
Last active June 2, 2018 13:05
Setup ec2
sudo yum update -y &&\
sudo yum install -y git zsh docker&&\
sudo service docker start &&\
sudo usermod -a -G docker ec2-user &&\
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh &&\
chsh -s $(which zsh) &&\
@jonchurch
jonchurch / payload_example.js
Last active October 18, 2017 06:03
Button payload example for FBM
// Match the payload in the format of <category>:<userID>:<step>
// No way in heck a user would accidentally type this, and if a hacker figured out how to pull payloads out of my buttons or get at userID's,
// I'd have bigger issues to worry about. But ultimately, I'm checking everything serverside (this is part of a game, so the server has final word) so its hardly an issue
controller.hears('^planet:([a-zA-Z0-9.]{24}):cats', 'message_received', function(bot, message) {
var cats = {
attachment: {
type: 'template',
payload: {
template_type: 'generic',
@jonchurch
jonchurch / ShareholderOrg.sol
Created November 13, 2017 02:57 — forked from anonymous/ShareholderOrg.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.18+commit.9cf6e910.js&optimize=false&gist=
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {