This file contains hidden or 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 pollGp() { | |
$.ajax({ | |
type: 'GET', | |
url: '/gp.fileupload.stat/${c.upload_id}', | |
cache: false, | |
dataType: 'json', | |
timeout: 5000, | |
success: function(response) { | |
if (response.state == 1) { | |
$('#progressbar div').css('width', response.percent + '%'); |
This file contains hidden or 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
# Fabrication | |
Fabricator(:user) do | |
email { sequence(:email) { |n| "tester#{n}@test.com" } } | |
password 'tester' | |
end | |
Fabricator(:store, from: :dropbox_store) do | |
path '/myproject' | |
end |
This file contains hidden or 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
# project.rb | |
class Store | |
include Mongoid::Document | |
end | |
class Project | |
include Mongoid::Document | |
field :name |
This file contains hidden or 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
Total: 24 samples | |
12 50.0% 50.0% 12 50.0% garbage_collector | |
2 8.3% 58.3% 2 8.3% Hash#[]= | |
1 4.2% 62.5% 1 4.2% ActiveSupport::Notifications::Fanout#publish | |
1 4.2% 66.7% 1 4.2% Array#inspect | |
1 4.2% 70.8% 1 4.2% BSON::OrderedHash.allocate | |
1 4.2% 75.0% 3 12.5% CBson.deserialize | |
1 4.2% 79.2% 1 4.2% Kernel#dup | |
1 4.2% 83.3% 1 4.2% Kernel#tap | |
1 4.2% 87.5% 1 4.2% Mongoid::Logger#debug |
This file contains hidden or 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
Total: 17 samples | |
4 23.5% 23.5% 4 23.5% garbage_collector | |
1 5.9% 29.4% 1 5.9% AbstractController::I18nProxy#initialize | |
1 5.9% 35.3% 1 5.9% ActionController::LogSubscriber#start_processing | |
1 5.9% 41.2% 1 5.9% ActionView::PathSet#find_all | |
1 5.9% 47.1% 13 76.5% ActiveSupport::Callbacks#run_callbacks | |
1 5.9% 52.9% 1 5.9% ActiveSupport::Configurable::ClassMethods#config | |
1 5.9% 58.8% 1 5.9% BSON::ObjectId#initialize | |
1 5.9% 64.7% 1 5.9% BSON::OrderedHash.allocate | |
1 5.9% 70.6% 1 5.9% Class#from_string |
This file contains hidden or 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
require 'benchmark' | |
require 'mongo' | |
require 'mongoid' | |
require './project' | |
db = Mongo::Connection.new.db('coledit_development') | |
Mongoid.configure do |config| | |
config.master = db | |
end |
This file contains hidden or 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 pymongo import Connection | |
from pymongo.objectid import ObjectId | |
connection = Connection() | |
db = connection.coledit_development | |
def test(): | |
project = db.projects.find_one({'_id': ObjectId('4e52ccbd3a5c9f20b8000003')}) | |
#print project['name'] |
This file contains hidden or 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 i, project; | |
for (i=0; i<1000000; ++i) { | |
project = db.projects.find({"_id": ObjectId("4ea1661a3a5c9f09b5000005")}); | |
project[0].name; // to actually fetch the object | |
} |
This file contains hidden or 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 mocha = require('./mocha'); | |
var Suite = mocha.Suite | |
, Test = mocha.Test; | |
/** | |
* BDD-style interface: | |
* | |
* describe('Array', function(){ | |
* describe('#indexOf()', function(){ | |
* it('should return -1 when not present', function(){ |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Google Charts</title> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
// Load the Visualization API and the piechart package. | |
google.load('visualization', '1.0', {'packages':['corechart']}); | |
function drawVisualization() { |
OlderNewer