This file contains hidden or 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 sample() { | |
if (condition1 === 'value1') { | |
if (condition2 === 'value2') { | |
if (condition3 === 'value3') { | |
throw 'wrong condition3'; | |
} else { | |
do_actual_work(); | |
and(); | |
return value(); | |
} |
This file contains hidden or 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
'BEFORE' |
This file contains hidden or 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
[07/18 17:29:46 GMT+0700] ld.so.1: node: fatal: relocation error: file /opt/haibu/apps/chakrit/refactor.io/package/node_modules/redis-url/node_modules/redis/node_modules/hiredis/build/Release/hiredis.node: symbol redisReaderCreate: referenced symbol not found |
This file contains hidden or 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
What does the code looks like BEFORE | |
applying your refactoring technique. | |
Makes the flaw obvious. |
This file contains hidden or 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 disablityAmount() { | |
if (_seniority < 2) return 0; | |
if (_monthsDisabled > 12) return 0; | |
if (_isPartTime) return 0; | |
execute(); | |
} |
This file contains hidden or 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
info: Welcome to Nodejitsu chakrit | |
info: It worked if it ends with Nodejitsu ok | |
info: Executing command deploy | |
info: Skipping require-analyzer because noanalyze option is set | |
info: Skipping require-analyzer because noanalyze option is set | |
info: Creating snapshot 0.1.1-1 | |
info: Updating app niyai | |
info: Activating snapshot 0.1.1-1 for niyai | |
info: Starting app niyai | |
error: Error running command deploy |
This file contains hidden or 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 checkSecurity(people) { | |
var found = false; | |
for (var i = 0; i < people.length; i++) { | |
if (!found) { | |
if (people[i] === 'Don') { | |
alert('Don is here!'); | |
found = true; | |
} | |
if (people[i] === 'John') { |
This file contains hidden or 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
[08/02 01:26:48 GMT+0700] [2012-08-01 18:26:48.686] [TRACE] NumberModel - add new number: { slug: 'king-chulalongkorn-memorial-hospital', | |
[08/02 01:26:48 GMT+0700] title: 'King Chulalongkorn Memorial Hospital', | |
[08/02 01:26:48 GMT+0700] 'title/th': '????????????????????????????????????????????????????????? ?????????????????????????????????', | |
[08/02 01:26:48 GMT+0700] tags: [ 'hospital', 'bangkok' ], | |
[08/02 01:26:48 GMT+0700] info: undefined, | |
[08/02 01:26:48 GMT+0700] number: '0-22564000' } | |
[08/01 23:08:06 GMT+0700] Error: Cannot find module 'icu-wordsplit' | |
[08/01 23:08:06 GMT+0700] at Function._resolveFilename (module.js:337:11) | |
[08/01 23:08:06 GMT+0700] at Function._load (module.js:279:25) |
This file contains hidden or 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
Express server listening on port 3000 in development mode | |
[2012-08-02 22:13:17.302] [TRACE] NumberModel - get number: 'asoke' | |
[2012-08-02 22:13:17.304] [TRACE] NumberModel - got number: null | |
[2012-08-02 22:13:17.304] [TRACE] IndexModel - get items from keyword: 'asoke' | |
[2012-08-02 22:13:17.305] [TRACE] IndexModel - got items: [ '1:asoke-skin-hospital' ] | |
[2012-08-02 22:13:17.305] [TRACE] NumberModel - get number: 'asoke-skin-hospital' | |
[2012-08-02 22:13:17.305] [TRACE] NumberModel - got number: '{"slug":"asoke-skin-hospital","title":"Asoke Skin Hospital","title/th":"โรงพยาบาลผิวหนัง อโศก โรงพยาบาลเฉพาะทางผิวหนัง","tags":["hospital","bangkok"],"info":{"facebook":"www.facebook.com/skinhospital/info","twitter":"twitter.com/skinhospital"},"number":"0-2246-5111"}' | |
[2012-08-02 22:13:17.306] [TRACE] Number - search for: 'asoke' ' result:' [ { slug: 'asoke-skin-hospital', | |
title: 'Asoke Skin Hospital', | |
'title/th': 'โรงพยาบาลผิวหนัง อโศก โรงพยาบาลเฉพาะทางผิวหนัง', |
This file contains hidden or 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
var assert = require('assert') | |
, N = 100000000 | |
, STR = '' | |
, STR2 = 'very very long the quick brown fox jumps over the lazy dog.'; | |
console.time('str.length == 0'); | |
for (var i = 0; i < N; i++) { | |
assert(STR.length == 0); | |
assert(STR2.length != 0); |