Skip to content

Instantly share code, notes, and snippets.

@zubairalam
zubairalam / res.render.js
Created November 24, 2016 08:07 — forked from mrlannigan/res.render.js
res.render Override Middleware
/**
* Override res.render to do any pre/post processing
*/
app.use(function(req, res, next) {
var render = res.render;
res.render = function(view, options, fn) {
var self = this,
options = options || {},
req = this.req,
app = req.app,
@zubairalam
zubairalam / bower.json
Last active May 23, 2016 15:22 — forked from ericlbarnes/bower.json
Gulp, Bower, Bootstrap Sass, FontAwesome
{
"name": "project",
"version": "0.0.0",
"authors": [
"Eric Barnes <[email protected]>"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
#!/bin/bash
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
brew install cabextract
cd ~/Downloads
mkdir consolas
cd consolas
curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
cabextract PowerPointViewer.exe
@zubairalam
zubairalam / Dockerfile
Created January 30, 2016 08:03 — forked from LeoCBS/Dockerfile
Dockerfile to up one spider/scrapy
FROM ubuntu:14.04
MAINTAINER likang
#instalando python e scrapy
RUN apt-get update
RUN apt-get install -y python python-pip python-dev libxml2-dev libxslt-dev libffi-dev libssl-dev
RUN pip install lxml && pip install pyopenssl && pip install Scrapy && pip install service_identity
#instalando o git
RUN apt-get install -y git
@zubairalam
zubairalam / for-loops.js
Created December 22, 2015 13:49 — forked from juliocesar/for-loops.js
ES6 - for loops
// ES6 for loops
// =============
// Things in ES6 can be "iterable". Arrays are iterable by default.
var fruits = ['Apple', 'Banana', 'Grape'];
for (var fruit of fruits)
console.log('Fruit: ' + fruit);
@zubairalam
zubairalam / gulpfile-express.js
Created November 30, 2015 07:15 — forked from mollerse/gulpfile-express.js
Gulpfile for livereload + static server
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@zubairalam
zubairalam / mongoexport_with_query.sh
Created November 20, 2015 12:00 — forked from hirobo/mongoexport_with_query.sh
Shell script for mongoexport with query
#!/bin/sh
#########################################################
# usage
#do_mongoexport '2015-04-01' '2015-04-02' 'hoge'
#########################################################
get_millis()
{
if [ $# != 1 ]; then
@zubairalam
zubairalam / make_csv.sh
Created November 20, 2015 12:00 — forked from jasonwash/make_csv.sh
Shell script to create a CSV file from a MongoDB collection. The CSV file will contain all possible top-level keys. Embedded documents are not handled.
#!/bin/bash
function usage {
printf "Usage:\n$0 <db_name> <collection_name> <output_csv_file>\n"
exit 1
}
db_name=$1
collection=$2
output_file=$3
@zubairalam
zubairalam / tmux_install.sh
Created November 4, 2015 15:30 — forked from P7h/tmux__CentOS__build_from_source.sh
tmux installation steps for Ubuntu
# tmux v2.0 installation steps for Ubuntu 14.04 (Trusty Tahr)
tmux -V
sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install -y tmux
tmux -V
# tmux v1.9 installation steps for Ubuntu 14.04 (Trusty Tahr)
@zubairalam
zubairalam / create_index.sh
Created October 13, 2015 09:07 — forked from bonzanini/create_index.sh
Elasticsearch/Python test
curl -XPOST http://localhost:9200/test/articles/1 -d '{
"content": "The quick brown fox"
}'
curl -XPOST http://localhost:9200/test/articles/2 -d '{
"content": "What does the fox say?"
}'
curl -XPOST http://localhost:9200/test/articles/3 -d '{
"content": "The quick brown fox jumped over the lazy dog"
}'
curl -XPOST http://localhost:9200/test/articles/4 -d '{