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
# Deploying a Sinatra app to Heroku | |
## Database | |
The location of the database Heroku provides can be found in the environment | |
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example | |
on how to use this. | |
## Server | |
Heroku is serving your apps with thin, with means you have all your thin goodness available, | |
such as EventMachine. |
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
#!/usr/bin/env ruby | |
STDIN.read.each do |line| | |
line.sub!(/^(\t+)/) { |c| ' ' * c.length } | |
line.sub!(/(\s+)$/, "\n") | |
puts line | |
end |
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 class DeliminatorSeparatedPropertyNamesContractResolver : DefaultContractResolver | |
{ | |
private readonly string _separator; | |
protected DeliminatorSeparatedPropertyNamesContractResolver(char separator) : base(true) | |
{ | |
_separator = separator.ToString(); | |
} | |
protected override string ResolvePropertyName(string propertyName) |
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
function debounce(fn, debounceDuration){ | |
// summary: | |
// Returns a debounced function that will make sure the given | |
// function is not triggered too much. | |
// fn: Function | |
// Function to debounce. | |
// debounceDuration: Number | |
// OPTIONAL. The amount of time in milliseconds for which we | |
// will debounce the function. (defaults to 100ms) |
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
float dpLength(DelaunayPoint p1, DelaunayPoint p2) { | |
float deltaX = p2.x - p1.x; | |
float deltaY = p2.y - p1.y; | |
float deltaZ = p2.z - p1.z; | |
return sqrt((deltaX * deltaX) + (deltaY * deltaY) + (deltaZ * deltaZ)); | |
} | |
DelaunayPoint dpAdd(DelaunayPoint p1, DelaunayPoint p2) | |
{ |
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
/* | |
Copyright 2011 Martin Hawksey | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
# !/bin/bash | |
# Copyright (c) 2011 Float Mobile Learning | |
# http://www.floatlearning.com/ | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the |
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
import functools | |
import logging | |
from google.appengine.api import memcache | |
def cached(time=1200): | |
""" | |
Decorator that caches the result of a method for the specified time in seconds. | |
Use it as: | |
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
// | |
// FMInfoPanelViewController.h | |
// Created by Florian Mielke (@FlorianMielke) on 06.12.11. | |
// | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import <QuartzCore/QuartzCore.h> | |
@interface FMInfoPanelViewController : UIViewController <UIScrollViewDelegate> |
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
// | |
// KDPersistantCache.h | |
// KDPrototype | |
// Stores NSCoding compliant objects persistantly in the NSCachesDirectory | |
// for a specified period of time. | |
// | |
// Created by on 18/04/2012. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// |
OlderNewer