This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema; | |
mongoose.connect('mongodb://localhost/blog'); | |
var Comments = new Schema({ | |
title : String | |
, body : String | |
, date : Date | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read a page's GET URL variables and return them as an associative array. | |
function getUrlVars() | |
{ | |
var vars = [], hash; | |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for(var i = 0; i < hashes.length; i++) | |
{ | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); | |
vars[hash[0]] = hash[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Component+residual plots with ggplot2, with support for interaction terms. | |
# Modeled after function "prplot" in package "faraway". | |
# | |
# Example usage: | |
# > print(ggprplots(lm(prestige~income+education, data=Prestige))) | |
library(ggplot2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Double computeDistance(GeoPoint p1, GeoPoint p2, String units){ | |
double distance = 0.0; | |
final double EarthRadiusMI = 3958.76; | |
final double EarthRadiusKM = 6371.01; | |
if(p1==null) throw new IllegalArgumentException("p1"); | |
if(p2==null) throw new IllegalArgumentException("p2"); | |
if(units == null) throw new IllegalArgumentException("units"); | |
units = units.toLowerCase().trim(); | |
if(!units.equalsIgnoreCase("km") && !units.equalsIgnoreCase("mi")) throw new IllegalArgumentException("Invalid value: " + units); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from alchemyapi import AlchemyAPI | |
import json | |
import re | |
txt = open("book.txt") | |
book_txt = txt.read() | |
book_chaps = book_txt.split('\n== ') | |
result = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oulu.fsecure.tdd.day2; | |
import java.util.ArrayList; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class Grid { | |
private int xSize; | |
private int ySize; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf-8 | |
execute pathogen#infect() | |
syntax on | |
filetype plugin on | |
filetype indent on | |
"" | |
"" Customisations | |
"" | |
highlight Pmenu ctermbg=238 gui=bold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################### | |
# Configuration | |
########################### | |
# use 256 term for pretty colors | |
set -g default-terminal "screen-256color" | |
# increase scroll-back history | |
set -g history-limit 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBUG=True | |
CSRF_COOKIE_SECURE=False | |
SESSION_COOKIE_SECURE=False | |
SECRET_KEY=s3cr3t | |
DATABASE_URL=sqlite:////tmp/db.sqlite3 | |
ALLOWED_HOSTS=* | |
EMAIL_BACKEND=django.core.mail.backends.filebased.EmailBackend | |
EMAIL_HOST=email_host | |
EMAIL_PORT=587 | |
EMAIL_HOST_USER=host_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.tmuxinator/rails-dev.yml | |
name: rails-dev | |
root: ~/Projects/galileo | |
# Optional tmux socket | |
# socket_name: foo | |
# Runs before everything. Use it to start daemons etc. | |
# pre: sudo /etc/rc.d/mysqld start |
OlderNewer