Skip to content

Instantly share code, notes, and snippets.

module Devise
module Orm
module MongoMapper
module Hook
def devise_modules_hook!
extend Schema
include Compatibility
yield
return unless Devise.apply_schema
devise_modules.each { |m| send(m) if respond_to?(m, true) }
require 'sinatra/base'
require 'omniauth'
class OmniauthExample < Sinatra::Base
configure do
use OmniAuth::Builder do
provider :facebook, FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, { :scope => 'email, publish_stream' }
provider :twitter, TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET
end
@andreaseger
andreaseger / gist:951557
Created May 2, 2011 12:50
Puzzle Generator Temporary Fix
vector<vector<pair<int,int> > > Generator::makePuzzle(vector<Piece>& pieces, vector<Edge*>& edgelist, bool** matrix){
vector<vector<pair<int,int> > > pids;
makePieceMesh(pids);
mesh2Matrix(pids,matrix);
makePieceList(pieces, pids);
create_edgelist(edgelist, pieces);
module Autotest::GnomeNotify
# Time notification will be displayed before disappearing automatically
EXPIRATION_IN_SECONDS = 2
ERROR_STOCK_ICON = "gtk-dialog-error"
SUCCESS_STOCK_ICON = "gtk-dialog-info"
# Convenience method to send an error notification message
#
# [stock_icon] Stock icon name of icon to display
@andreaseger
andreaseger / gist:1010045
Created June 6, 2011 10:28
mongodb growth_test v1.8.1
MongoDB shell version: 1.8.1
connecting to: growth_test
0: size/storage: 0/21248256 | deleted: n: 100005 size: 21247024
1: size/storage: 0/21248256 | deleted: n: 141305 size: 21247024
2: size/storage: 0/33327616 | deleted: n: 184377 size: 33326208
3: size/storage: 0/33327616 | deleted: n: 223757 size: 33326208
4: size/storage: 0/33327616 | deleted: n: 245265 size: 33326208
5: size/storage: 0/33327616 | deleted: n: 292805 size: 33326208
6: size/storage: 0/33327616 | deleted: n: 323678 size: 33326208
7: size/storage: 0/33327616 | deleted: n: 339713 size: 33326208
@andreaseger
andreaseger / gist:1010047
Created June 6, 2011 10:29
mongodb growth_test v1.8.2-rc2-pre- (cwolfinger)
MongoDB shell version: 1.8.2-rc2-pre-
connecting to: growth-test
0: size/storage: 0/21248256 | deleted: n: 100001 size: 21247024
1: size/storage: 0/21248256 | deleted: n: 100288 size: 21247024
2: size/storage: 0/21248256 | deleted: n: 100298 size: 21247024
3: size/storage: 0/21248256 | deleted: n: 100298 size: 21247024
4: size/storage: 0/21248256 | deleted: n: 100298 size: 21247024
5: size/storage: 0/21248256 | deleted: n: 100389 size: 21247024
6: size/storage: 0/21248256 | deleted: n: 100389 size: 21247024
7: size/storage: 0/21248256 | deleted: n: 100389 size: 21247024
@andreaseger
andreaseger / growth_test.js
Created June 6, 2011 10:30
mongodb growth test
function randomString(length) {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = length;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
return randomstring;
}
@andreaseger
andreaseger / compiling fix for ubuntu.patch
Created June 8, 2011 08:57
mongodb compiling fix for ubuntu
From da09184386aedaddd091e497a283b68585f3b634 Mon Sep 17 00:00:00 2001
From: Eger Andreas <experteer@eger-andreas.de>
Date: Wed, 8 Jun 2011 09:36:56 +0200
Subject: [PATCH 167/167] compiling fix for ubuntu
Signed-off-by: Eger Andreas <experteer@eger-andreas.de>
---
SConstruct | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@andreaseger
andreaseger / code.html
Created July 19, 2011 13:54
dynamically add and remove dom elements(with js)
<div class="bodyClip" >
<div id="moreUploads">
<div id="att1">
<input type="file" name="appdocs_services[attachment1]" id="appdocs_services[attachment1]" onchange="document.getElementById('moreUploadsLink').style.display = 'block';" />
</div>
</div>
<div id="moreUploadsLink" style="display:none;"><a href="javascript:addFileInput();">Eine weitere Datei hinzufügen.</a></div>
<p><i>(Format erlaubt : PDF, doc)</i></p>
</div>
@andreaseger
andreaseger / miniuploader.html
Created July 20, 2011 14:42
a very compact drag and drop image uploader written in html5 an javascript
<!DOCTYPE html>
<!-- This is the shortest Image Uploader ever :)
And you can even make it shorter if you don't
want all the drag'n drop thing. -->
<!--
AUTHOR: @paulrouget <paul@mozilla.com>
LICENSE: