This file contains 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
public static String makeMoneyFormat(int money) { | |
StringBuilder str = new StringBuilder(""); | |
StringBuilder target = new StringBuilder(String.valueOf(money % 1000)); | |
while ((money /= 1000) > 0) { | |
while (target.length() < 3) | |
target.insert(0, "0"); | |
str.insert(0, target); | |
str.insert(0, ","); |
This file contains 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
function parse(route, pathname) { | |
var keys = []; | |
var regexpstr = route.split('/').map(function(part) { | |
if (part.startsWith(':')) { | |
keys.push(part.substring(1)); | |
return '([^/]+)'; | |
} else { | |
return escape(part); | |
} |
This file contains 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
function build(uri, params) { | |
console.log('@', uri, ' <- ', params); | |
var built = uri.replace(/\/:[^/]+/g, function(match) { | |
var key = match.substring(2); | |
return '/' + params[key]; | |
}); | |
console.log('built:', built); | |
} | |
build('/hoge/:fuga/:foobar', { |
This file contains 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
hover() { | |
/body:not(.__device-touchdevice) {selector()}:hover { | |
{block}; | |
} | |
} |
This file contains 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
media(query) | |
@media query | |
/{selector()} | |
{block} | |
tablet() | |
+media("screen and (max-width: 1023px)") | |
{block} | |
mobile() |
This file contains 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
const axios = { | |
get: (...args) => new Promise((resolve, reject) => { | |
console.log('called', args.join(', ')); | |
setTimeout(() => resolve(args.join(', ')), 1500); | |
}), | |
}; | |
const api = { | |
get: (...args) => new Promise((resolve, reject) => { | |
queue.push(async () => { |
This file contains 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
function toBooleanWithDefault (value: unknown, def: boolean) { | |
return typeof value === 'boolean' ? value : def | |
} |
This file contains 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
@mixin z-flow-flex($columns: 1, $margin-longitudinal: 0px, $margin-lateral: 0px, $child-selector: '*') { | |
display: flex; | |
flex-wrap: wrap; | |
> #{$child-selector} { | |
$width: calc((100% - #{$margin-lateral} * #{$columns - 1}) / #{$columns}); | |
flex: 0 0; | |
flex-basis: $width; | |
width: $width; |
This file contains 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
const ALIGN_WEEK_NUM = false | |
const now = new Date() | |
const [ | |
year = now.getFullYear().toString(), | |
month = (now.getMonth() + 1).toString(), | |
] = process.argv.slice(2) | |
const targetYear = parseInt(year) |
This file contains 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
class RandomAccessPool<T> { | |
readonly items: readonly T[] | |
protected pool: T[] = [] | |
constructor(items: T[]) { | |
this.items = items | |
} | |
get() { | |
if (!this.pool.length) { |
OlderNewer