Skip to content

Instantly share code, notes, and snippets.

View schancel's full-sized avatar

Shammah Chancellor schancel

View GitHub Profile
// Tree fiddy
defaultDonation = 3.50;
function getBCHPrice () {
return new Promise((resolve, reject) => {
jQuery.getJSON('https://index-api.bitcoin.com/api/v0/cash/price/usd', function (result) {
if (result.price != '') {
var singleDollarValue = result.price / 100;
var singleDollarSatoshis = 100000000 / singleDollarValue * defaultDonation;
resolve(singleDollarSatoshis);
@schancel
schancel / uncrustify-d.cfg
Created April 23, 2015 14:56
Uncrustify config for beautiful D code
tok_split_gte=false
utf8_byte=false
utf8_force=false
indent_cmt_with_tabs=true
indent_align_string=true
indent_braces=false
indent_braces_no_func=false
indent_braces_no_class=false
indent_braces_no_struct=false
indent_brace_parent=false
tok_split_gte=false
utf8_byte=false
utf8_force=false
indent_cmt_with_tabs=true
indent_align_string=true
indent_braces=false
indent_braces_no_func=false
indent_braces_no_class=false
indent_braces_no_struct=false
indent_brace_parent=false
string evalString(Expression e) in {
// FIXME: newtype
// assert(cast(SliceType) peelAlias(e.type).type, "this only CTFE strings.");
} body {
// Create a global variable that recieve the string.
auto stringType = codeGen.visit(e.type);
auto receiver = LLVMAddGlobal(codeGen.dmodule, stringType, "__ctString");
scope(exit) LLVMDeleteGlobal(receiver);
@schancel
schancel / std_concepts.html
Created October 19, 2014 01:43
Std.concepts
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang='en-US'>
<!--
Copyright (c) 1999-2010 by Digital Mars
All Rights Reserved Written by Walter Bright
http://www.digitalmars.com
-->
@schancel
schancel / concepts.d
Created October 18, 2014 22:45
Concept diagnostic diagnostic messages
module concepts;
private import std.typetuple;
private import std.traits;
//Gets the member type, even for properties.
private template getMemberType(C, string memberName)
{
alias member = TypeTuple!(__traits(getMember, C, memberName))[0];
@schancel
schancel / gist:3ad09f6f0223935301b1
Last active August 29, 2015 14:07
Concepts checker for D.
module concepts;
private import std.typetuple;
private import std.typecons;
private import std.traits;
private import std.stdio;
private template getMemberType(C, string memberName)
{
alias member = TypeTuple!(__traits(getMember, C, memberName))[0];