timestamp = ->
  now = new Date()
  return (
        now.getFullYear() + '-' 
        + ("00" + (now.getMonth()+1)).substr(-2,2) + '-' 
        + ("00" + now.getDate()).substr(-2,2) + ' ' 
        + ("00" + now.getHours()).substr(-2,2) + ':' 
        + ("00" + now.getMinutes()).substr(-2,2) + ':' 
        + ("00" + now.getSeconds()).substr(-2,2) + '.' 
        + ("000" + now.getMilliseconds()).substr(-3,3)
  )

javascript pad strpad

[ ]
 

(function(root, factory) {

  // это для загрузчика модуля АМД
  if (typeof define === 'function' && define.amd) { // то есть, если можем дотянуться до define с amd,
    define(['underscore', 'jquery', 'exports'], function(_, $, exports) { // то им модуль и создадим
      // а вдруг кто-то ждет бэкбон еще и в глобальном объекте
      root.Backbone = factory(root, exports, _, $);
    });

  // это для Node, где jQuery не нужен
  } else if (typeof exports !== 'undefined') {
    var _ = require('underscore');
    factory(root, exports, _);

  // это для браузера
  } else {
    root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
  }

}(this, function(root, Backbone, _, $) { }));
[ ]
 

It's probably not a good idea to eliminate it at all...

if typeof @ isnt 'object' then throw "Constructor called as function."

 

ssh tunnel

Don't use -R never ever if you don't want to pull the hair from your ass trying to figuring what's wrong.

ssh -v -i ~/.ssh/ID_FILE -f -N -L YOUR_MACHINE_PORT:IP_ACCESSIBLE_FROM_REMOTE_MACHINE:ACCESSIBLE_IP_PORT username@REMOTE_MACHINE

[ ]
 

args = [{},@GET,@POST].reduce (prev,curr) -> prev[key] = curr[key] for key of curr; return prev

[ ]
 

du -d 3 -c -h|grep "[0-9]G"

 

port = yield prompt('FTP Port: [21] ') or 21

[ ]
 

find /path/dir -name "*.txt"|xargs -I % mv % /new/path/

После -I идёт символизирующий собою input xargs символ.

[ ]
 

sudo npm install -g git+https://git@github.com/alubbe/coffee-script.git

[ ]
 

Однажды в студеную зимнюю пору
Сижу за решеткой в темнице сырой.
Гляжу: поднимается медленно в гору
Вскормленный в неволе орел молодой.

И, шествуя важно, в спокойствии чинном,
Мой старый товарищ, махая крылом,
В больших сапогах, в полушубке овчинном
Кровавую пищу клюет под окном.

— Это что за остановка?
Бологое иль Поповка? –
а с платформы говорят:
— Это город Грозний, бляд!!!

Взял наливки из черешен,
Взял пельменей, сел за стол.
We don't need no education
We don't need no thought control