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
| import os | |
| import csv | |
| f = os.path.join('/Users/ismail/sandbox/repos_own/pyf/','tmp.txt') | |
| FIELDS = [ | |
| 'A', | |
| 'B', | |
| 'C', | |
| 'D' |
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
| charts_dict = { | |
| 'inactivity': { | |
| 'title': 'Inactivity Aging Summary' , | |
| 'url': 'inactivity.json', | |
| 'container': 'inactivity', | |
| 'width': '100%', | |
| 'height': '250' | |
| } | |
| } | |
| @app.route('/dashboard') |
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 flask import Flask | |
| app = Flask(__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
| def collision_prob(numIndices, numInsertions): | |
| ''' | |
| Given the number of buckets and the number of items to insert, | |
| calculates the probability of a collision. | |
| ''' | |
| prob = 1.0 | |
| for i in range(1, numInsertions): | |
| prob = prob * ((numIndices - i) / float(numIndices)) | |
| return 1 - prob |
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
| import random | |
| def noReplacementSimulation(numTrials): | |
| ''' | |
| Runs numTrials trials of a Monte Carlo simulation | |
| of drawing 3 balls out of a bucket containing | |
| 3 red and 3 green balls. Balls are not replaced once | |
| drawn. Returns the a decimal - the fraction of times 3 | |
| balls of the same color were drawn. | |
| ''' | |
| count_matches = 0 |
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
| Place holder |
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
| import datetime | |
| from flask import url_for | |
| from dashboard import db | |
| class Page(db.Document): | |
| title = db.StringField(max_length=100, required=True) | |
| slug = db.StringField(max_length=100, required=True) | |
| parent = db.StringField(max_length=100, required=False, default='') |
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
| import random, pylab | |
| #set line width | |
| pylab.rcParams['lines.linewidth'] = 6 | |
| #set font size for titles | |
| pylab.rcParams['axes.titlesize'] = 20 | |
| #set font size for labels on axes | |
| pylab.rcParams['axes.labelsize'] = 20 | |
| #set size of numbers on x-axis | |
| pylab.rcParams['xtick.major.size'] = 5 |
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
| # run rails c test | |
| require 'capybara/dsl' | |
| Capybara.app = app.instance_variable_get("@app") | |
| cap = Object.new.instance_eval { extend Capybara::DSL; self } | |
| cap.visit '/' | |
| cap.page.find 'tr' |
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
| Running: rake assets:precompile | |
| rake aborted! | |
| undefined method `match' for nil:NilClass | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/mongo_uri.rb:49:in `initialize' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:103:in `new' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:103:in `parse' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:62:in `create_session' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:43:in `default' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions.rb:109:in `default' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid.rb:124:in `default_session' |