Skip to content

Instantly share code, notes, and snippets.

Jason Huang kaddopur

View GitHub Profile
View roman.ex
defmodule Roman do
@roman_symbols [
["M", 1000],
["CM", 900],
["D", 500],
["CD", 400],
["C", 100],
["XC", 90],
["L", 50],
["XL", 40],
@kaddopur
kaddopur / isTaiwanId.es6
Created Sep 7, 2016
身分證字號檢查
View isTaiwanId.es6
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('')
View rx.jsx
class Foo extends React.Component {
constructor(props) {
super(props);
this.state = {
filterText: '',
locations: []
}
}
updateFilter(e) {
View a.js
$.get( "your_partial.html", function( data ) {
$( "#your_div" ).html( data );
alert( "Load was performed." );
});
View gist:deb3cd738f1e5f04fc4e
npm install -g yo
npm install -g generator-fluxible
@kaddopur
kaddopur / gist:972ad28a7018fd5f95b6
Created Mar 3, 2015
install generator-fluxible
View gist:972ad28a7018fd5f95b6
$ npm install -g yo
$ npm install -g generator-fluxible
$ yo fluxible
View twenty_four.rb
def twenty_four(*operands)
p operands
operators = %w(+ - * /)
operands.map! {|op| op.to_f}
operands.permutation.to_a.uniq.each do |ordered_operands|
operators.repeated_permutation(operands.length-1) do |ordered_operators|
check_answer(ordered_operands, ordered_operators)
end
end
@kaddopur
kaddopur / gist:3419a0c8b6e8933fbaea
Created May 28, 2014
Install new ruby version with rbenv in OS X with proper utf-8 support in irb
View gist:3419a0c8b6e8933fbaea
brew install readline
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p392
View bootstrap-ckeditor-modal-fix.js
// bootstrap-ckeditor-modal-fix.js
// hack to fix ckeditor/bootstrap compatiability bug when ckeditor appears in a bootstrap modal dialog
//
// Include this AFTER both bootstrap and ckeditor are loaded.
// From: http://stackoverflow.com/questions/14420300/bootstrap-with-ckeditor-equals-problems
// Author: http://stackoverflow.com/users/185839/aaron
$.fn.modal.Constructor.prototype.enforceFocus = function() {
modal_this = this
$(document).on('focusin.modal', function (e) {
View L00.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
</head>
<body>
</body>
</html>
You can’t perform that action at this time.