Skip to content

Instantly share code, notes, and snippets.

// config/passport.js
// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',

Bash (Readline)

Moving

ctrl + a                 Goto BEGINNING of command line
ctrl + e                 Goto END of command line
ctrl + b                 move back one character

ctrl + f move forward one character

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@mjurincic
mjurincic / word_markdown_macro.txt
Created April 20, 2015 07:47
Word to markdown macro
'*** A simple MsWord->Markdown replacement macro by Kriss Rauhvargers, 2006.02.02.
'*** This tool does NOT implement all the markup specified in MarkDown definition by John Gruber, only
'*** the most simple things. These are:
'*** 1) Replaces all non-list paragraphs to ^p paragraph so MarkDown knows it is a stand-alone paragraph
'*** 2) Converts tables to text. In fact, tables get lost.
'*** 3) Adds a single indent to all indented paragraphs
'*** 4) Replaces all the text in italics to _text_
'*** 5) Replaces all the text in bold to **text**
'*** 6) Replaces Heading1-6 to #..#Heading (Heading numbering gets lost)
'*** 7) Replaces bulleted lists with ^p * listitem ^p* listitem2...
@mjurincic
mjurincic / file_read.js
Last active August 29, 2015 14:20
Node presentaion examples
var http = require('http');
var fs = require('fs');
http.createServer(function(request, response){
response.writeHead(200);
fs.readFile('index.html', function(err, contents){
response.write(contents);
response.end();
});
}).listen(8080);
@mjurincic
mjurincic / ntp.bash
Created April 28, 2015 13:34
synchronize time using NTP
$ sudo ntpdate pool.ntp.org
$ sudo service ntp stop
$ sudo ntpdate pool.ntp.org
$ sudo service ntp start
$ sudo ntpdate -u pool.ntp.org
# xcode-select --print-path => https://developer.apple.com/downloads
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask
brew install node
npm install npm -g
@mjurincic
mjurincic / app.js
Created November 19, 2015 00:38 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');