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
My thoughts on writing tiny reusable modules that each do just one | |
thing. These notes were adapted from an email I recently sent. | |
*** | |
If some component is reusable enough to be a module then the | |
maintenance gains are really worth the overhead of making a new | |
project with separate tests and docs. Splitting out a reusable | |
component might take 5 or 10 minutes to set up all the package | |
overhead but it's much easier to test and document a piece that is |
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
import React from 'react'; | |
class Test extends React.Component { | |
/** | |
* Test ์ ์์ฑ์ | |
* @constructs | |
* @param {Test.propTypes} props | |
*/ | |
constructor(props) { |
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
import React from 'react'; | |
/** | |
* Define React Component $class$ | |
*/ | |
class $class$ extends React.Component { | |
/** | |
* Constructor for $class$ | |
* @constructs |
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
public JSONObject GET (String url) { | |
JSONObject json; | |
try { | |
URL target = new URL(url); | |
HttpURLConnection urlcon = (HttpURLConnection) target.openConnection(); | |
InputStream in = new BufferedInputStream(urlcon.getInputStream()); | |
BufferedReader streamReader = new BufferedReader(new InputStreamReader(in, "UTF-8")); | |
StringBuilder responseStrBuilder = new StringBuilder(); | |
String inputStr; | |
while ((inputStr = streamReader.readLine()) != null) |
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
private class RestApi extends AsyncTask<String, Void, JSONObject> { | |
@Override | |
protected JSONObject doInBackground(String... params) { | |
return this.GET(params[0]); | |
} | |
@Override | |
protected void onPostExecute(JSONObject jsonObject) { | |
super.onPostExecute(jsonObject); | |
this.onReceived(jsonObject); |
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
// test1.js | |
var name = 'hckrmoon'; | |
module.exports = name; |
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 isActive = $('body').hasClass('active'); | |
if (isActive) { | |
$('p').show(); | |
} | |
// Application ์ state ๋ฅผ View ์ ์ ์ ํ๊ณ ์๋ค. |
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
const a = { blah: 1 }; | |
const b = { blah: 1 }; | |
const c = a; | |
const d = { blah: 2 }; | |
const deepCompare = (obj1, obj2) => { | |
// ์ฒซ๋ฒ์งธ ์ค๋ธ์ ํธ์ ํ๋กํผํฐ๋ฅผ ์ํํฉ๋๋ค. | |
for (var p in obj1) { | |
// ๋ ์ค๋ธ์ ํธ ๋ชจ๋ ๊ฐ์ง๊ณ ์์ง ์๋ ํ๋กํผํฐ์ด๋ฉด ๋ ์ค๋ธ์ ํธ๋ ๊ฐ๋ค๊ณ ํ ์ ์์ต๋๋ค. | |
if (obj1.hasOwnProperty(p) !== obj2.hasOwnProperty(p)) return false; |
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
/* | |
* Declare Object | |
*/ | |
let profile = { | |
name: 'yunmi', | |
age: '26', | |
nickname: 'pinky' | |
}; | |
/* |
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 state = { | |
name: 'jooyoung Moon' | |
}; | |
var reduce = function reduce(state) { | |
return _.extends({}, state, { | |
name: 'hckrmoon' | |
}); | |
}; |
OlderNewer