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
//Simple random string generator in JS | |
Math.random().toString(36); |
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
// Here is how the react compenent is append to the html element in the app | |
// ReactDOM.render( | |
// <MarkdownEditor />, | |
// document.getElementById('markdown-example') | |
// ); | |
class MarkdownEditor extends React.Component { | |
constructor(props) { | |
super(props); | |
this.handleChange = this.handleChange.bind(this); |
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
// excample | |
const listOfThingWithDuplicate = [1,2,3,4,4,100,4,2,6]; | |
const listWithOutDuplicateElements = [...new Set(listOfThingWithDuplicate)]; | |
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 dependencies into an array of strings. | |
const { dependencies } = require('./package.json'); | |
const libs = Object.keys(dependencies); |
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
$ npm install pdfmake | |
//It's very important to follow this order | |
import pdfFonts from 'pdfmake/build/vfs_fonts'; | |
import pdfMake from 'pdfmake/build/pdfmake'; | |
//It's a important one too |
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
"subtleBrackets.styles": { | |
"global": { | |
"color": "white", | |
"backgroundColor": "rgba(0, 255, 0, 0.3)", | |
"borderColor": "1px yellow", | |
"borderWidth": "1px", | |
"borderStyle": "none none dotted", | |
"padding":"20px" | |
} |
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
// regular Promise() | |
function fetchAlbums() { | |
fetch('https://http://rallycoding.herokuapp.com/api/music_albums') | |
.then(res => res.json()) | |
.then(json => console.log(json)); | |
} | |
//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
console.log('%c Oh my heavens Amigos! ', 'background: #222; color: #bada55'); | |
console.log('%c a colorful message', 'background: green; color: white; display: block;'); | |
var styles = [ | |
'background: linear-gradient(#D33106, #571402)' | |
, 'border: 1px solid #3E0E02' | |
, 'color: white' |
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
txtblk='[\e[0;30m]' # Black | |
txtred='\[\e[0;31m\]' # Red | |
txtgrn='\[\e[0;32m\]' # Green | |
txtylw='\[\e[0;33m\]' # Yellow | |
txtblu='\[\e[0;34m\]' # Blue | |
txtpur='\[\e[0;35m\]' # Purple | |
txtcyn='\[\e[0;36m\]' # Cyan | |
txtwht='\[\e[0;37m\]' # White | |
txtrst='\[\e[0m\]' # Text Reset |
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
$ open -a TextEdit .bash_profile | |
txtblk='[\e[0;30m]' # Black | |
txtred='\[\e[0;31m\]' # Red | |
txtgrn='\[\e[0;32m\]' # Green | |
txtylw='\[\e[0;33m\]' # Yellow | |
txtblu='\[\e[0;34m\]' # Blue | |
txtpur='\[\e[0;35m\]' # Purple | |
txtcyn='\[\e[0;36m\]' # Cyan | |
txtwht='\[\e[0;37m\]' # White |
NewerOlder