Skip to content

Instantly share code, notes, and snippets.

View grabbeh's full-sized avatar

grabbeh

  • UK
View GitHub Profile
@grabbeh
grabbeh / Favourite it!
Created October 7, 2012 14:47
Find map -> update map -> find user -> update user
exports.favourite = function(req, res) {
console.log(req.body);
Map.findOne({_id: req.body.id}, function(err, map){
if (!err) {
map.update({favourited: req.body.plusone}, {upsert: true}, function(err) {
if (err) {console.log("Error with incrementing favourite")}
else {
if (!req.user) {
res.send("Please login to favourite this route")
function(doc) {
emit(doc._id, doc);
}
@grabbeh
grabbeh / gist:6247736
Last active December 21, 2015 04:09
Nginx conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@grabbeh
grabbeh / gist:6247773
Created August 16, 2013 06:38
Proxy headers.conf
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $proxy_host;
proxy_set_header X-NginX-Proxy true;
@grabbeh
grabbeh / gist:6261321
Created August 18, 2013 12:06
Express hello world
var express = require('express')
, app = express()
app.get('/', function(req, res){
res.send('Hello World')
});
app.listen(3000);
<div class="imp-text"
data-25-top-top="opacity: 1; background: rgb(255,247,165); left: 0px;"
data-25-top-bottom="opacity: 0; background: rgb(255,255,255); left: 200px;"
data--25-bottom-top="opacity: 0; left: 200px; background: rgb(255,255,255);"
data--25-bottom-bottom="opacity: 1; left: 0px; background: rgb(255,247,165);">
Kidney due within 30 days of signature</div>
var express = require('express')
, fs = require('fs')
, cheerio = require('cheerio')
, app = express();
app.configure(function(){
app.use(express.bodyParser());
});
app.post('/', function(req, res){
@grabbeh
grabbeh / gist:6721046
Last active December 24, 2015 00:59
Nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[{"name":"Afghanistan","alpha-2":"AF","alpha-3":"AFG","country-code":"004","iso_3166-2":"ISO 3166-2:AF","region-code":"142","sub-region-code":"034"},{"name":"Ã…land Islands","alpha-2":"AX","alpha-3":"ALA","country-code":"248","iso_3166-2":"ISO 3166-2:AX","region-code":"150","sub-region-code":"154"},{"name":"Albania","alpha-2":"AL","alpha-3":"ALB","country-code":"008","iso_3166-2":"ISO 3166-2:AL","region-code":"150","sub-region-code":"039"},{"name":"Algeria","alpha-2":"DZ","alpha-3":"DZA","country-code":"012","iso_3166-2":"ISO 3166-2:DZ","region-code":"002","sub-region-code":"015"},{"name":"American Samoa","alpha-2":"AS","alpha-3":"ASM","country-code":"016","iso_3166-2":"ISO 3166-2:AS","region-code":"009","sub-region-code":"061"},{"name":"Andorra","alpha-2":"AD","alpha-3":"AND","country-code":"020","iso_3166-2":"ISO 3166-2:AD","region-code":"150","sub-region-code":"039"},{"name":"Angola","alpha-2":"AO","alpha-3":"AGO","country-code":"024","iso_3166-2":"ISO 3166-2:AO","region-code":"002","sub-region-code":"017"