Skip to content

Instantly share code, notes, and snippets.

@maestrow
maestrow / CrtlZ.coffee
Last active August 29, 2015 13:58
nodejs: Processing Ctrl+Z in stdin on Windows
compare = (buf1, buf2) ->
return false if buf1.length != buf2.length
for i in [0...buf1.length]
return false if buf1[i] != buf2[i]
true
isCtrlZ = (chunk) -> compare chunk, [26,13,10]
input = (cb) ->
result = ''
@maestrow
maestrow / GenericUtils.coffee
Last active August 29, 2015 14:00
Generic helper methods and techniques that can be useful in every project.
isArray = (x) ->
typeof x is 'object' and x.constructor is Array
Array::last = -> @[@length - 1]
@maestrow
maestrow / git-checkout-from-a-specific-directory.sh
Created July 24, 2014 08:44
Git checkout from a specific directory
# http://stackoverflow.com/questions/17833185/git-checkout-from-a-specific-directory
# Method №1
mkdir <repo.git>
mkdir <working-dir>
git clone <repo-url> <repo.git> --bare --depth 1
git --git-dir=<repo.git> --work-tree=<working-dir> checkout HEAD -- <repo-subdir>
# Method №2
mkdir <working-dir>
@maestrow
maestrow / requirejs-cheatsheet.md
Last active August 29, 2015 14:04
Requirejs Cheat Sheet
@maestrow
maestrow / Cakefile
Created August 3, 2014 20:32
Modular Cakeflle
# http://www.mikedellanoce.com/2013/04/coffeescript-tip-modular-cakefile.html
fs = require('fs')
tasks = fs.readdirSync('tasks')
require('./tasks/' + task.replace(/\.coffee$/, '')) for task in tasks

MongoDB is:

  • JSON storage
  • schemaless
  • NOT support SQL

Functionality that missing in MongoDB (in order to retain scalability):

  • Joins between collections
  • Transactions across multiple collections
@maestrow
maestrow / readme.md
Created April 15, 2016 10:29
Музыкальная гармония

Вопросы:

  • Почему октава разделена именно на 12 частей?
  • Почему натуральные лады содержат 7 ступеней? Почему исторически сложились именно такие интервальные структуру в натуральных ладах?

Ответы:

@maestrow
maestrow / 0_reuse_code.js
Created December 15, 2016 21:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@maestrow
maestrow / post.md
Last active February 28, 2017 10:35
F# Developers Scratchpad #F#

Задачи

  • REPL
  • Визуализация результатов выполнения команд

Ссылки

Начнем с простого: