Skip to content

Instantly share code, notes, and snippets.

Shammah Chancellor schancel

View GitHub Profile
View Badger button
// 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 Apr 23, 2015
Uncrustify config for beautiful D code
View uncrustify-d.cfg
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
View gist:c42c34c5fe40fe793578
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
View evalString.d
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);
View std_concepts.html
<!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 Oct 18, 2014
Concept diagnostic diagnostic messages
View concepts.d
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 Aug 29, 2015
Concepts checker for D.
View gist:3ad09f6f0223935301b1
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];
You can’t perform that action at this time.