Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am thinkholic on github.
  • I am thinkholic (https://keybase.io/thinkholic) on keybase.
  • I have a public key ASBnhPdIw8TKISqTf0fcisC4vS0eIjr90WWjm7RvpXlQygo

To claim this, I am signing this object:

@thinkholic
thinkholic / snakecoin-js.js
Last active Oct 11, 2018
JS/nodejs version for aunyks/snakecoin.py
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 Object.prototype.js
Object.prototype.isEmpty = function() {
var obj = this;
for (var key in obj) {
if (obj.hasOwnProperty(key)) return false;
}
return true;
}
View Validator.js
class Validator {
schema = null;
constructor(schema) {
this.schema = schema;
}
run(values) {
const schema = this.schema;
const errors = {};
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-alphabetical-order-example.css
.alert {
background-color: #eee; /* temporarily put here */
border: 1px solid #ccc;
display: block;
font-size: 10px;
padding: 5px 10px;
}
.box {
top: 0;
View flow-css-disable-rule-example.css
.alert {
border: 1px solid #ccc;
padding: 5px 10px;
font-size: 10px;
x-display: block; /* disabled */
}
View flow-css-test-styles-example.css
.alert {
border: 1px solid #ccc;
padding: 5px 10px;
font-size: 10px;
display: block;
background-color: #eee; /* temporarily put here */
}