Skip to content

Instantly share code, notes, and snippets.

View kaddopur's full-sized avatar

Jason Huang kaddopur

View GitHub Profile
npm install -g yo
npm install -g generator-fluxible
$.get( "your_partial.html", function( data ) {
$( "#your_div" ).html( data );
alert( "Load was performed." );
});
class Foo extends React.Component {
constructor(props) {
super(props);
this.state = {
filterText: '',
locations: []
}
}
updateFilter(e) {
@kaddopur
kaddopur / isTaiwanId.es6
Created September 7, 2016 16:23
身分證字號檢查
function isTaiwanId(id) {
const mapping = [10, 11, 12, 13, 14, 15, 16, 17, 34, 18, 19, 20, 21, 22, 35, 23, 24, 25, 26, 27, 28, 29, 32, 30, 31, 33];
const ID_REGEX = /^[A-Z][12]\d{8}$/i;
if (!ID_REGEX.test(id)) {
return false;
}
return `${mapping[id.toUpperCase().charCodeAt(0)-65]}${id.slice(1)}`
.split('')
defmodule Roman do
@roman_symbols [
["M", 1000],
["CM", 900],
["D", 500],
["CD", 400],
["C", 100],
["XC", 90],
["L", 50],
["XL", 40],
@kaddopur
kaddopur / test.diff
Created May 15, 2020 06:52
test diff
- await CrumbService.read(mockReq, 'CrumbService', { foo: 'foo' }, {}, callback);
+ await new Promise(resolve =>
+ CrumbService.read(mockReq, 'CrumbService', { foo: 'foo' }, {}, (...args) => {
+ callback(...args);
+ resolve();
+ })
+ );