Skip to content

Instantly share code, notes, and snippets.

@3cp
3cp / gist:5538314
Created May 8, 2013 05:04
Ruby equivalent code of Javascript encodeURIComponent(...)
require 'uri'
# same result as Javascript encodeURIComponent(...)
puts URI.escape(ARGV[0], Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
@3cp
3cp / bootstrap3_button.css
Created January 2, 2014 23:23
top up bootstrap 3 theme for button press down feeling.
.btn:active,
.btn.active {
padding-top: 7px;
padding-bottom: 5px;
}
.btn-lg:active,
.btn-lg.active {
padding-top: 11px;
padding-bottom: 9px;
@3cp
3cp / mode-pdflib-liquid.js
Created February 12, 2015 23:13
ace syntax highlighting example (pdflib + liquid mix)
ace.define('ace/mode/pdftemplate', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/pdftemplate_highlight_rules'], function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var PdfTemplateHighlightRules = require("./pdftemplate_highlight_rules").PdfTemplateHighlightRules;
var Mode = function() {
this.$tokenizer = new Tokenizer(new PdfTemplateHighlightRules().getRules());
};
@3cp
3cp / app.html
Last active September 23, 2016 04:05
aurelia-test
<template>
<require from="./child"></require>
<button click.delegate="newItems()">new items</button>
<child repeat.for="item of items" id.bind="item.id" value.bind="item.value"></child>
</template>
@3cp
3cp / app.html
Last active September 13, 2016 07:39
aurelia-repeat
<template>
<require from="./person"></require>
<button click.delegate="addPerson()">Add Customer</button>
<person repeat.for="person of people" person.bind="person"></person>
</template>
@3cp
3cp / app.html
Last active September 16, 2016 00:06
aurelia-repeat with deep-diff
<template>
<require from="./person"></require>
${mirrorPeople.length}
<button click.delegate="addPerson()">Add Customer</button>
<person
repeat.for="person of mirrorPeople"
id.bind="person.id"
firstname.bind="person.firstname"
lastname.bind="person.lastname"
delete.call="deletePerson(person.id)"></person>
@3cp
3cp / app.html
Last active October 2, 2018 22:31 — forked from jdanyow/app.html
input date
<template>
<input type="date" value.bind="value | momentDate">
<p>Value: ${value}</p>
</template>
@3cp
3cp / app.html
Last active September 21, 2016 05:40
aurelia svg if binding
<template>
<button click.delegate="toggleLine()">toggleLine</button><br/>
<p
if.bind="line"
class.bind="line.sx"></p>>
</template>
@3cp
3cp / app.html
Last active October 11, 2016 02:03
array observer
<template>
<require from="./line"></require>
<button click.delegate="reverseItems()">reverse array</button>
<ul>
<li as-element="line" repeat.for="item of items" model.bind="item" label.bind="labels[item.s]"></li>
</ul>
</template>
@3cp
3cp / app.html
Last active October 11, 2016 03:07
valueChanged
<template>
<require from="./line"></require>
<line value.bind="1"></line>
</template>