Skip to content

Instantly share code, notes, and snippets.

View drinchev's full-sized avatar
©️
...

Ivan Drinchev drinchev

©️
...
View GitHub Profile
@drinchev
drinchev / mac
Created May 28, 2013 13:16
Disable the Window Shadow on Screen Shots in Mac OS X
#
# Disable MAC OS X screenshot ( Shift + Cmd + 4, Space ) shadow
#
# ref: http://osxdaily.com/2011/05/23/disable-shadow-screen-shots-mac/
#
defaults write com.apple.screencapture disable-shadow -bool true
killall SystemUIServer
# To revert back to default use :
@drinchev
drinchev / gist:4709257
Created February 4, 2013 20:05
Basic socket.io + express app
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
io = require('socket.io').listen(server);
app.get('/', function(req, res) {
res.send('<!doctype html> \
<html> \
<head><meta charset="utf-8"></head> \
@drinchev
drinchev / app.js
Created February 4, 2013 19:41
socket.io + expressJS + cookies authorization Just run this file with the dependencies : express , cookie , connect , socket.io `npm i [dependency]`
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
users = 0,
MemoryStore = express.session.MemoryStore,
sessionStore = new MemoryStore(),
parseCookie = require('cookie').parse,
utils = require('connect').utils,
io = require('socket.io').listen(server);
@drinchev
drinchev / require.js
Created May 9, 2012 17:34
implementation of require
(function() {
var modules = {}, cache = {};
if (this.require && this.require.modules) {
modules = this.require.modules;
}
var require = function(name, root) {
var path = expand(root, name), indexPath = expand(path, './index'), module, fn;
module = cache[path] || cache[indexPath];
@drinchev
drinchev / gist:2266544
Created March 31, 2012 16:26
Integrate NowJS with Express and Passport
var express = require('express')
, passport = require('passport')
, sessionStore = new express.session.MemoryStore()
, app = module.exports = express.createServer()
, nowjs = require('now');
app.configure( function () {
app.use(express.bodyParser());