Skip to content

Instantly share code, notes, and snippets.

View mwawrusch's full-sized avatar

Martin Wawrusch mwawrusch

View GitHub Profile
ar http = require('http');
var fs = require('fs');
var util = require('util');
var fileCache;
var sendFile = function(conn, file) {
conn.writeHead(200, {"Content-Type": "text/html", "Content-Length": file.length});
conn.write(file);
conn.end();
}
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_multiTenant');
/**
* User schema.
*/
var UserSchema = new mongoose.Schema({
name: String
, prefix: { type: String, required: true }
@gudbergur
gudbergur / README.markdown
Created February 19, 2012 23:49
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@ngs
ngs / gradient_support.rb
Created February 2, 2012 10:36
a patch to fix compass raising error when using 'transparent' keyword for gradiention: 'Expected a color. Got: transparent'
## If you are using under a rails project,
## I recommend to put this script onto config/initializer instead of applying the patch
module Compass::SassExtensions::Functions::GradientSupport
class ColorStop < Sass::Script::Literal
def initialize(color, stop = nil)
self.options = {}
if color.is_a?(Sass::Script::String) && color.value == 'transparent'
@pksunkara
pksunkara / clarg.md
Created December 16, 2011 12:27
Command Line Arguments Specification

Command Line Arguments Specification

This specification defines Command Line Arguments level 1 (CLARG 1.0). This document aims to direct development of command line tools conform to a set of rules while parsing options.

Arguments

The different type of arguments are:

  • Short Option
  • Long Option
begin
require 'aws/s3'
rescue LoadError => e
e.message << " (You may need to install the aws-s3 gem)"
raise e
end
class SitemapS3Publisher
def generate
sitemap.create
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
module Paperclip
class << self
def logger #:nodoc:
MongoMapper.logger
end
end
module ClassMethods
def has_attached_file name, options = {}
include InstanceMethods
@kneath
kneath / _README.md
Created November 18, 2009 21:42 — forked from defunkt/bundle.rake
Intelligent asset bundling for Rails (GitHub's asset bundling)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
@jschementi
jschementi / git-cheat.rdoc
Created January 31, 2009 18:44
Git cheatsheets

Add colors to your ~/.gitconfig file:

[color]
  branch = auto
  diff = auto
  status = auto
[color "branch"]
  current = yellow reverse
  local = yellow
  remote = green
[color "diff"]