This file contains hidden or 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
(ns pattern.core) | |
(defn translate [x y] | |
(str "translate(" x "," y ")")) | |
(def pack | |
(.. js/d3 | |
-layout | |
pack | |
(size (array (- diameter 4) (- diameter 4))) |
This file contains hidden or 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
syntax on | |
set tabstop=2 | |
set guifont=consolas | |
set number | |
colorscheme material | |
highlight OverLength ctermbg=red ctermfg=white guibg=#592929 | |
match OverLength /\%81v.\+/ |
This file contains hidden or 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
Array.prototype.ifNotEmpty = function(fn, otherwise) { | |
return this.length !== 0 | |
? fn.call(this) | |
: otherwise; | |
}; | |
function maxDepth(struct) { | |
return struct.children && Array.isArray(struct.children) | |
? struct.children | |
.map(function(child) { |
This file contains hidden or 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
/** | |
* Grammar for validating simple SQL selects. | |
* @author Marcelo Camargo | |
* @since 2015/08/26 | |
*/ | |
{ | |
var Sql = { | |
listToString: function(x, xs) { | |
return [x].concat(xs).join(""); |
This file contains hidden or 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
let (<@>) | |
= macro { | |
case { _ $name:ident } => { | |
letstx $str = [makeValue(unwrapSyntax(#{$name}), #{here})]; | |
return #{$str}; | |
} | |
} | |
macro enum { | |
case { |
This file contains hidden or 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
%{ | |
/** | |
* Lexical grammar for matching PHP integers | |
* @author Marcelo Camargof | |
*/ | |
#include <math.h> | |
#include <stdlib.h> | |
%} |
This file contains hidden or 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
{ | |
"type": "Program", | |
"value": [ | |
{ | |
"type": "Expr", | |
"value": { | |
"type": "LetExpr", | |
"typedef": { | |
"type": "TypeDef", | |
"class": "PrimitiveType", |
This file contains hidden or 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
/** | |
* Grammar for (T)emplate (Q)uery (L)anguage | |
* @author Marcelo Camargo | |
* @since 2015/10/08 | |
*/ | |
{ | |
var TypeChecker = { | |
assert: function(t1, t2) { | |
if (t1 !== t2) { | |
throw new TypeError("Type [" + t2 + "] is not assignable to [" + t1 + "]"); |
This file contains hidden or 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
[PHP] | |
;;;;;;;;;;;;;;;;;;; | |
; About php.ini ; | |
;;;;;;;;;;;;;;;;;;; | |
; PHP's initialization file, generally called php.ini, is responsible for | |
; configuring many of the aspects of PHP's behavior. | |
; PHP attempts to find and load this configuration from a number of locations. | |
; The following is a summary of its search order: |
This file contains hidden or 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
<?php | |
// Build a function which can double a list | |
$double_list = partial 'array_map' on (function($x) { return $x * 2; }); | |
$double_list([1, 2, 3, 4, 5]); // [2, 4, 6, 8, 10] |