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 / 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');
@mjurincic
mjurincic / markdown-cheatsheet.md
Created July 12, 2016 11:52 — forked from james2doyle/markdown-cheatsheet.md
Another markdown cheatsheet. More straightforward examples.

Any block of text surrounded by line breaks is considered a paragraph.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Alternatively, for H1 and H2, an underline-ish style:

@mjurincic
mjurincic / Sortable.jsx
Created January 13, 2017 10:17 — forked from superKalo/ Sortable.jsx
How to use jQuery UI with React JS? You can use this approach to integrate almost any jQuery plugin! Full details and explanation here: http://stackoverflow.com/a/40350880/1333836
class Sortable extends React.Component {
componentDidMount() {
// Every React component has a function that exposes the
// underlying DOM node that it is wrapping. We can use that
// DOM node, pass it to jQuery and initialize the plugin.
// You'll find that many jQuery plugins follow this same pattern
// and you'll be able to pass the component DOM node to jQuery
// and call the plugin function.
@mjurincic
mjurincic / server.js
Created January 28, 2017 16:14 — forked from nodkz/apolloServer2019.ts
GraphQL error tracking with sentry.io
/* eslint-disable no-console, import/first */
import path from 'path';
import express from 'express';
import expressStaticGzip from 'express-static-gzip';
import graphqlHTTP from 'express-graphql';
import PrettyError from 'pretty-error';
import bodyParser from 'body-parser';
import raven from 'raven';
import morgan from 'morgan';
import { graphqlBatchHTTPWrapper } from 'react-relay-network-layer';
@mjurincic
mjurincic / relayStore.js
Created January 28, 2017 16:17 — forked from nodkz/relayStore.js
relayStore with `reset` and simplified `mutate` methods
let relayStore;
function relayCreateStore() {
const env = new Relay.Environment();
env.injectNetworkLayer(new Relay.DefaultNetworkLayer('/graphql'));
if (__DEV__) {
RelayNetworkDebug.init(env);
}
env.reset = () => relayCreateStore();
env.mutate = ({
query,
@mjurincic
mjurincic / routes.js
Created January 28, 2017 16:19 — forked from nodkz/routes.js
import React from 'react';
import Relay from 'react-relay';
import { relayStore } from 'app/clientStores'; // relayStore = Relay.Store;
import App from 'app/_components/App/App';
import Menu from 'app/Menu/Menu';
import MainPage from 'app/MainPage/MainPage';
import Page404 from 'app/_components/Page404/Page404';
import LoadingPage from 'app/_components/LoadingPage/LoadingPage';
import BrokenPage from 'app/_components/BrokenPage/BrokenPage';