Skip to content

Instantly share code, notes, and snippets.

@hostsamurai
hostsamurai / python_dep_workaround.sh
Created August 28, 2013 04:46
Prevent NPM modules using node-gyp from freaking out on Arch Linux
export PYTHON=python2
npm install module-name
@hostsamurai
hostsamurai / app.js
Created June 9, 2013 23:48
This solves two gotchas I came across when deploying a node site running express through systemd: 1) Remove the callback in `listen` or the requests will hang, and 2) tell systemd what the working directory for your app is.
var express = require('express')
, http = require('http')
, path = require('path');
require('systemd');
var app = express();
// configuration and routes go here...
@hostsamurai
hostsamurai / apps.js
Last active December 14, 2015 05:29 — forked from eliOcs/apps.js
consolidate.js lets you specify partials in your render functions. The gist assumes you have index.html and partial.html inside of your views folder.
/*jslint node: true */
"use strict";
var express = require("express"),
consolidate = require("consolidate"),
Handlebars = require("handlebars"),
fs = require("fs");
var app = express();
@hostsamurai
hostsamurai / canvas.html
Created July 1, 2011 16:54
Light flickering effect using html5 canvas and JavaScript
<canvas width=220 height=150></canvas>
@hostsamurai
hostsamurai / configure user
Created April 5, 2011 17:00
Set up a new user to be a reader
Add the user to _users:
$ curl -X POST 'http://admin:admin_pass@127.0.0.1:5984/_users/' -H 'Content-Type: application/json' -d @user.json
@hostsamurai
hostsamurai / gist:851996
Created March 2, 2011 23:29
Unable to use HTTP proxy handler in CouchDB's externals API
Apache CouchDB 1.0.2 (LogLevel=debug) is starting.
Configuration Settings ["/etc/couchdb/default.ini","/etc/couchdb/local.ini"]:
[async_mailer] port="9000"
[attachments] compressible_types="text/*, application/javascript, application/json, application/xml"
[attachments] compression_level="8"
[couch_httpd_auth] auth_cache_size="50"
[couch_httpd_auth] authentication_db="_users"
[couch_httpd_auth] authentication_redirect="/_utils/session.html"
[couch_httpd_auth] require_valid_user="false"
[couch_httpd_auth] secret="0c0cd567d2672d625bc8f493c9b2b354"
@hostsamurai
hostsamurai / sinatra_compass_font_face.rb
Created October 27, 2010 04:42
Get @font-face working again in Sinatra 1.1.0 and Compass 0.10.5
# Sinatra couldn't load my fonts once I updated to the latest version (1.1.0).
# The solution was to specify the mime types for those fonts.
## mime types for fonts
mime_type '.woff', "application/x-woff"
mime_type '.ttf', "application/x-font-ttf"
mime_type '.eot', "application/vnd.ms-fontobject"
// Sass (SCSS) version of the Simpler CSS Grid system
// http://www.webdesignerwall.com/tutorials/the-simpler-css-grid/
$grid-width: 978px;
$column-width: 54px;
$column-gutter: 30px;
.grid-col {
float: left;
" Vim syntax file
" Language: HTML (version 5)
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
" URL: http://rm.blog.br/vim/syntax/html.vim
" Last Change: 2009 Aug 19
" License: Public domain
" (but let me know if you liked it :) )
"
" Note: This file just adds the new tags from HTML 5
" and don't replace default html.vim syntax file