Mac: Compress a folder into multiple zip files

Create multiple zip use command

zip -r -s 64 FolderName/
  • 64 is the size of the split (in this case 64Mb).
  • Use -s to set the split size and create a split archive.
  • The size is given as a number followed optionally by one of k (kB), m (MB), g (GB), or t (TB) (the default is m).

laravel 5.3 authentication with jenssegers-mongodb

Add package to laravel

Install using composer:

composer require jenssegers/mongodb-session

Change the session driver in app/config/session.php to mongodb:

'driver' => 'mongodb',

Optional: change the connection to a connection using the mongodb driver from app/config/database.php:

'connection' => 'mongodb',


'providers' => [

User model

namespace App;

use Illuminate\Notifications\Notifiable;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Eloquent implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
    use Authenticatable, Authorizable, CanResetPassword;
    use Notifiable;

     * The database table used by the model.
     * @var string
    protected $collection = 'users';

    * The database primary key value.
    * @var string
    protected $primaryKey = '_id';

     * The attributes that are mass assignable.
     * @var array
    protected $fillable = [
        'name', 'email', 'password',

     * The attributes that should be hidden for arrays.
     * @var array
    protected $hidden = [
        'password', 'remember_token',

and try to register/login

Handlebars.js Loop for helper

If you just wanted to do something n times then:

Handlebars.registerHelper('times', function(n, block) {
    var accum = '';
    for(var i = 0; i < n; ++i)
        accum += block.fn(i);
    return accum;


{{#times 10}}

If you wanted a whole for(;;) loop, then something like this:

Handlebars.registerHelper('for', function(from, to, incr, block) {
    var accum = '';
    for(var i = from; i < to; i += incr)
        accum += block.fn(i);
    return accum;


{{#for 0 10 2}}


handlebars.js: Logical operator helper


var hbs = require('hbs');

    eq: function (v1, v2) { return v1 === v2; },
    ne: function (v1, v2) { return v1 !== v2; },
    lt: function (v1, v2) { return v1 < v2; },
    gt: function (v1, v2) { return v1 > v2; },
    lte: function (v1, v2) { return v1 <= v2; },
    gte: function (v1, v2) { return v1 >= v2; },
    and: function (v1, v2) { return v1 && v2; },
    or: function (v1, v2) { return v1 || v2; }


{{#if (or section1 section2)}}
.. content


{{#if (or 
        (eq section1 "foo")
        (ne section2 "bar"))}}
.. content


HTTP request logger middleware for node.js

For Install

npm i morgan -save -g


// environment
var express = require("express");
var morgan = require("morgan");
var app = express();

// routing
app.get('/', function(req, res){

// middleware
app.use(morgan('dev')); // for HTTP request logger

// request port
    console.log('server still running...');