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 * as React from "react"; | |
const Text = (props) => { | |
return ( | |
<div style={{ border: "1px solid red", padding: "20px" }}> | |
<p>this is text</p> | |
<div>{props.children}</div> | |
</div> | |
); | |
}; |
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
{ | |
"editor.snippetSuggestions": "top", | |
"editor.suggestSelection": "first", | |
"editor.cursorSmoothCaretAnimation": false, | |
"editor.smoothScrolling": true, | |
"editor.fontSize": 14, | |
"editor.fontFamily": "Monaco", | |
"editor.fontWeight": "bold", | |
"editor.formatOnSave": true, | |
"emmet.triggerExpansionOnTab": true, |
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
// Typescript Documentation: | |
// https://www.typescriptlang.org/docs/ | |
// Basic Types | |
const message: string = "Hello world"; | |
const messageArr: Array<string> = [message]; | |
console.log(message); | |
console.log(messageArr); | |
const isValid: boolean = 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
// https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.5/dist/global/Rx.umd.js | |
Rx.Observable.create(function(observer) { | |
let counter = 0; | |
setInterval(function() { | |
observer.next((counter += 2)); | |
}, 2000); | |
}).subscribe( | |
function(val) { |
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
// users | |
const users = [ | |
{ | |
id: 0, | |
name: "Rocky" | |
}, | |
{ | |
id: 1, | |
name: "John" | |
}, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>firebase</title> | |
</head> | |
<body> | |
<script src='https://cdn.firebase.com/js/client/2.2.1/firebase.js'></script> | |
<script> | |
// var ref = new Firebase('https://test231.firebaseio.com/'); |
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 asyncFun = function(someUrl, resolve, reject) { | |
$.get(someUrl) | |
.done(function(response) { | |
if(response) { | |
resolve(response); | |
} else { |
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
// Arrows | |
// A function shorthand that binds `this` value. | |
// Arrow functions are always anonymous. | |
// | |
// // Basic syntax: | |
// (param1, param2, paramN) => { statements } | |
// (param1, param2, paramN) => expression | |
// equivalent to: => { return expression; } | |
// Parentheses are optional when there's only one argument: |
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
// Airnb's style guide for writing better javascript | |
// Reference: https://github.com/airbnb/javascript | |
// Primitives | |
const foo = 1; | |
let bar = foo; | |
bar = 9; | |
console.log(foo, bar); // => 1, 9 |
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
// Reference: http://www.html5rocks.com/en/tutorials/es6/promises/ | |
// `Promises` have been introduced natively as a part of ES6 now. In this blogpost hopefully I will | |
// try to explore all the aspects of `Promises`. | |
// So what is a Promise? | |
// `Promises` are merely a prettier way of writing code which makes an asynchronous code look like synchronous. | |
// Usual way of XHR | |
$.get("script.php", function(data) { | |
console.log('Your account has been created successfully!'); |
NewerOlder