View snakecoin-js.js
// JS/nodejs version for aunyks/snakecoin.py
// Original: https://gist.github.com/aunyks/8f2c2fd51cc17f342737917e1c2582e2
const sha256 = require('js-sha256');
// Define the Block Class
class Block {
constructor(index, data, previousHash) {
this.index = index;
this.timestamp = new Date();
View js string.toTitleCase
toTitleCase(str: string) {
console.log('str: ', str);
return str.toLowerCase().split(' ').map(function(word) {
return (word.charAt(0).toUpperCase() + word.slice(1));
}).join(' ');
}
https://medium.freecodecamp.org/three-ways-to-title-case-a-sentence-in-javascript-676a9175eb27
View sendgrid-sample.js
// function helloEmail(){
// var helper = require('sendgrid').mail
// from_email = new helper.Email("test@example.com")
// to_email = new helper.Email("test@example.com")
// subject = "Hello World from the SendGrid Node.js Library"
// content = new helper.Content("text/plain", "some text here")
// mail = new helper.Mail(from_email, subject, to_email, content)
// email = new helper.Email("test2@example.com")
// mail.personalizations[0].addTo(email)
View flow-css-naming-convention-bem-like-example.css
.alerts {} /* block */
.alerts__error {} /* element */
.alerts--show {} /* state */
View flow-css-naming-convention-semantic-example.css
// Incorrect:
<div class="article">
<div class="title">Title</div>
<div class="content">Article contents goes here!</div>
</div>
.article {}
.article .title {}
.article .content {}
View flow-css-naming-convention-ids-classes.css
// Incorrect
<ul id="list-1"></ul>
<ul id="list-2"></ul>
<img class="main-logo" />
#list-1, #list-2 {}
.main-logo {}
// Correct:
<ul class="list" id="list-1"></ul>
View flow-css-simplified-example.css
// Incorrect:
#sidebar {
background-color: #fff;
background-image: (bg.png);
background-position: 0 0;
}
// Correct:
#sidebar {
background: #fff url(bg.png) repeat-x 0 0;