Skip to content

Instantly share code, notes, and snippets.

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

/*
*
* There is now an Angular directive, filter and provider!
* It can be found here: https://github.com/i18next/ng-i18next
* ng-i18next is now part of the i18next rganization!
*
*/
/*
* AngularJS directive for using i18next (http://jamuhl.github.com/i18next)
@borm
borm / passport.js
Last active August 29, 2015 14:19 — forked from manjeshpv/passport.js
// 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',
@borm
borm / box-shadow.html
Last active September 13, 2015 16:42 — forked from ocean90/box-shadow.html
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@borm
borm / gulpfile.js
Created September 29, 2015 10:25 — forked from jshbrntt/gulpfile.js
Browserify + Watchify + Browser Sync + Bower
/* global require */
var _ = require('lodash');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var buffer = require('vinyl-buffer');
var del = require('del');
var gulp = require('gulp');
var gutil = require('gulp-util');
var minify = require('gulp-minify-css');
@borm
borm / Font Face(sass).md
Created September 30, 2015 16:58 — forked from jonathantneal/README.md
SASS @font-face mixin

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@borm
borm / convert-UNIX-timestamp.js
Created January 4, 2016 23:49 — forked from kmaida/convert-UNIX-timestamp.js
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@borm
borm / ajax.js
Created January 6, 2016 23:31 — forked from skhatri/ajax.js
simple ajax - cors request, jsonp, xmlhttprequest
function Ajax() {
}
Ajax.prototype.jsonpHandler = function (url, callback) {
var scripturl = url + ((url.indexOf("?") !== -1) ? "&" : "?") + "callback=" + callback;
document.write('<script src="' + scripturl + '"></script>');
return scripturl;
};
Ajax.prototype.request = function (method, url, fallback, options) {
@borm
borm / ajax.js
Created January 8, 2016 20:01 — forked from xeoncross/ajax.js
Simple, cross-browser Javascript POST/GET xhr request object. Supports request data and proper AJAX headers.
/**
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
*
* @param string url
* @param object callback
* @param mixed data
* @param null x
*/
function ajax(url, callback, data, x) {
try {