Skip to content

Instantly share code, notes, and snippets.

@sjohnr
sjohnr / app.html
Last active June 8, 2017 03:16 — forked from AStoker/app.html
Select Material
<template>
<require from="./ux-select"></require>
<div style="margin: 20px 0;">
<ux-select options.bind="['Option 1', 'Option 2', '', 'Option 3']" value="Option 2"></ux-select>
</div>
<div style="margin: 20px 0;">
<ux-select options.bind="['Some other option', 'A second option', 'A third option', 'A really long fourth option that is wider than the known universe']"></ux-select>
</div>
<div style="margin: 20px 0;">
<ux-select options.bind="['CA', 'NE', 'WY']"></ux-select>
enum class CharacterClass(val regex: String) {
Alpha("[A-Za-z]"), UpperAlpha("[A-Z]"), LowerAlpha("[a-z]"), Numeric("[0-9]"), AlphaNumeric("[A-Za-z0-9]"), Symbol("[!@#$%^&*()\\-_+|~=`{}\\[\\]:\";'<>?,.\\/\\\\]"), Character(".")
}
enum class PolicyType(val text: String) {
MustContain("MUST contain"), MustNotContain("MUST NOT contain"), MustMatch("MUST match")
}
enum class RangeType(val text: String) {
AtMost("at most %s"), AtLeast("at least %s"), Exactly("exactly %s"), Between("between %s and %s")
@sjohnr
sjohnr / SGML.g4
Last active February 6, 2016 06:21
SGML (Sounds like sigmal)
grammar SGML;
// rules
root : aggregate ;
aggregate : START_TAG ( aggregate | element )* END_TAG ;
element : START_TAG content END_TAG? ;
content : WORD+ ;
// tokens
START_TAG : LT IDENTIFIER GT ;
@sjohnr
sjohnr / TestZreLogMsg.java
Last active August 29, 2015 14:02
GSL Codec
package org.zyre;
import static org.junit.Assert.*;
import org.junit.Test;
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Socket;
import org.zeromq.ZFrame;
import org.zeromq.ZContext;
/**
@sjohnr
sjohnr / Grunge.g4
Created March 12, 2014 02:13
Learning ANTLR
grammar Grunge;
root : statement*;
// language rules
literal : LITERAL
| '{' LITERAL ( ',' LITERAL )* '}'
;
variable : VAR ;
constant : CONSTANT ;