Skip to content

Instantly share code, notes, and snippets.

Juan Job Rodriguez jjsub

Block or report user

Report or block jjsub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View generateRandomString.js
//Simple random string generator in JS
Math.random().toString(36);
View insertReactComponentToANonReactAPP.js
// 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);
View removeDuplicateFromArray.js
// excample
const listOfThingWithDuplicate = [1,2,3,4,4,100,4,2,6];
const listWithOutDuplicateElements = [...new Set(listOfThingWithDuplicate)];
View dependenciesIntoArrayOfStrings.js
// import dependencies into an array of strings.
const { dependencies } = require('./package.json');
const libs = Object.keys(dependencies);
View brackets.highligts.for.vscode.js
"subtleBrackets.styles": {
"global": {
"color": "white",
"backgroundColor": "rgba(0, 255, 0, 0.3)",
"borderColor": "1px yellow",
"borderWidth": "1px",
"borderStyle": "none none dotted",
"padding":"20px"
}
View async.await.example.js
// regular Promise()
function fetchAlbums() {
fetch('https://http://rallycoding.herokuapp.com/api/music_albums')
.then(res => res.json())
.then(json => console.log(json));
}
//async
View set-up.makePDF.js
$ 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
View color.log.js
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'
View basic.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
txtrst='\[\e[0m\]' # Text Reset
View add.element.to.array.inmutable.way.js
addElement = (arr, index, element) => {
return [
...arr.slice(0, index),
element,
...arr.slice(index)
];
}
You can’t perform that action at this time.