This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the canonical layout file for the Quantum project. If you want to add another keyboard, | |
// this is the style you want to emulate. | |
#include "planck.h" | |
#ifdef BACKLIGHT_ENABLE | |
#include "backlight.h" | |
#endif | |
// Each layer gets a name for readability, which is then used in the keymap matrix below. | |
// The underscores don't mean anything - you can have a layer called STUFF or any other name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JSON | |
# JSON.mapping documentation removed, as it's taking to much spaces :p | |
# prop: the properties, like JSON.mapping | |
# decl: whatever or not to generate the variables declarations, getters & setters | |
# more_init: if not nil, must be a TupleLiteral that is the list of additional fields to the initialize method | |
macro mapper(props properties, strict = false, decl gen_declarations = true, more_init = nil) | |
{% for key, value in properties %} | |
{% properties[key] = {type: value} unless value.is_a?(HashLiteral) || value.is_a?(NamedTupleLiteral) %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "red", | |
"key": "red", | |
"android": "red", | |
"default": { | |
"strength": 500, | |
"hex": "#f44336", | |
"contrast": "white" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kilobyte = 1024u32 | |
Megabyte = 1024u32 * Kilobyte | |
Gigabyte = 1024u32 * Megabyte | |
def write_debug(str) | |
LibC.write 1, str, str.size | |
end | |
class FatalOOMError < Exception | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SharedNode | |
ADDRESS_PROXY = {} of Int32 => {UInt64, Node.class} | |
@@last_id = 0 | |
def self.add_node(node) | |
@@last_id += 1 | |
ADDRESS_PROXY[@@last_id] = {node.as(Void*).address, node.class} | |
@@last_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Contract | |
# We put everything in `included` macro so the constants don't clashes | |
# when used in multiple classes | |
macro included | |
CONTRACTS_FOR_DEF = {} of _ => _ | |
macro __add_contract(contract) | |
\{% if CONTRACTS_FOR_DEF[:next_def] == nil %} | |
\{% CONTRACTS_FOR_DEF[:next_def] = [contract] %} | |
\{% else %} | |
\{% CONTRACTS_FOR_DEF[:next_def] << contract %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Super Fast Blur v1.1 | |
// by Mario Klingemann <http://incubator.quasimondo.com> | |
// | |
// Tip: Multiple invovations of this filter with a small | |
// radius will approximate a gaussian blur quite well. | |
// | |
BImage a; | |
BImage b; | |
void setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Following: https://fsharpforfunandprofit.com/posts/understanding-parser-combinators/ | |
require "spec" | |
# Result types | |
record Success(T), value : T, remaining : String do | |
def_equals_and_hash value, remaining | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/crystal-lang/crystal/blob/26635f1052b99ab5b52a8b051020a25435dba751/src/compiler/crystal/semantic/literal_expander.cr | |
macro expand_literal_ArrayLiteral_empty(node) | |
{% puts "--- expansion for: #{node}" %} | |
Array({{ node.of }}).new | |
{% debug %} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#macro data(name, &block) | |
#end | |
# | |
# #### Ultimately I want to do this: | |
# and be able to make a pre-allocated buffer of Person, | |
# and be able to get a reference to a single Person (but pre-allocated | |
# in that buffer) | |
# | |
#data Person do | |
# property name : String |
OlderNewer