Skip to content

Instantly share code, notes, and snippets.

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

Ivan Drinchev drinchev

©️
...
View GitHub Profile
@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());
@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 / 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 / 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 / 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 / run
Last active August 29, 2015 14:07
qmail start script ( http://www.lifewithqmail.org/lwq.html )
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
# Throw this in config/initializers and add
# @import variables.sass to the top of application.sass
# to have all variables in app_config.yml
# available as variables in your sass stylesheets
#
# First draft by unixmonkey (http://gist.github.com/323198)
# flatten() added by Raphael J. Schmid <raphael.schmid@gmail.com>
# Full re-write. Configuration function added and can be used in compass/sass
#
# Example configuration.yaml
@drinchev
drinchev / SassMeister-input.scss
Created December 12, 2014 20:21
Generated by SassMeister.com.
// ----
// Sass (v3.4.0.rc.1)
// Compass (v1.0.0.alpha.20)
// ----
$themes: (
"theme-1": (
"color": red
),
"theme-2": (
<!DOCTYPE html>
<html>
<head>
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script>
tinymce.init({
selector:'#editor',
min_height : 300,
Verifying that +drinchev is my blockchain ID. https://onename.com/drinchev