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
# Compile it with: crystal build --prelude=empty --emit llvm-ir noprelude_exception.cr | |
lib LibC | |
alias SizeT = UInt64 | |
fun printf(format : UInt8*, ...) : Int32 | |
fun exit(exit_code : Int32) : NoReturn | |
end | |
require "callstack/lib_unwind" |
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
# How to use / how it works: | |
# | |
# NOTE: The server reads on STDIN, and writes on STDOUT | |
# | |
# Start the program. Now you can write something then press enter. | |
# The server will do something 'useful' with the input, and gives you the result. | |
# | |
# The requests/responses are handled asynchronously, and can handle multiple requests at the same time. | |
# | |
# So you can spam the input (write a lot of lines) then close the input (Ctrl-d on a terminal), and |
OlderNewer