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
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 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 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 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 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 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 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 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 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 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