Skip to content

Instantly share code, notes, and snippets.

View dmitriz's full-sized avatar

Dmitri Zaitsev dmitriz

View GitHub Profile
@dmitriz
dmitriz / style_guide.md
Created April 19, 2018 16:39 — forked from dominictarr/style_guide.md
style guide

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@dmitriz
dmitriz / myRSI.js
Created January 10, 2018 04:55 — forked from howie50417/myRSI.js
myRSI.js
var _ = require('lodash');
var log = require('../core/log.js');
var RSI = require('./indicators/RSI.js');
// let's create our own method
var method = {};
// prepare everything our method needs
method.init = function() {
@dmitriz
dmitriz / db-alt.js
Created May 13, 2017 06:47 — forked from i-am-tom/db-alt.js
Database failover modelled with the `alt` typeclass.
const Task = require('data.task')
Task.prototype.alt = function (that) {
return new Task((rej, res) =>
this.fork(_ => that.fork(rej, res), res))
}
const hosts = [
[ 'db1.mysite.com', 'user', 'password' ],
[ 'db2.mysite.com', 'user', 'password' ],
@dmitriz
dmitriz / _baseline.scss
Last active October 8, 2020 22:01 — forked from razwan/_baseline.scss
Aligning type to baseline the right way with SASS
// font-size of the regular font used
$base-font-size: 16px;
// it is convenient to declare a fixed base-line-height,
// so every other line-height is a simple multiple of base-line-height
$base-line-height: 21px; // 1.5 * base-font-size
// allow fractional line-height as integer multiple of base-line-height / line-height-scale
$line-height-scale: 1;
@dmitriz
dmitriz / .jshintrc.js
Created January 25, 2016 21:35 — forked from connor/.jshintrc.js
jshintrc example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
@dmitriz
dmitriz / README.md
Created January 6, 2016 15:51 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

var gulp = require('gulp');
// Let's make things more readable by
// encapsulating each part's setup
// in its own method
function startExpress() {
var express = require('express');
var app = express();
app.use(express.static(__dirname));