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
| Error starting application | |
| Your Rack app raised an exception when Pow tried to run it. | |
| LoadError: no such file to load -- bundler/setup | |
| ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
| ~/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
| ~/Projects/demo_app/config/boot.rb:6:in `<top (required)>' | |
| <internal:lib/rubygems/custom_require>:29:in `require' | |
| <internal:lib/rubygems/custom_require>:29:in `require' | |
| ~/Projects/demo_app/config/application.rb:1:in `<top (required)>' | |
| <internal:lib/rubygems/custom_require>:29:in `require' |
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
| # subclassed/partner/models.py | |
| from django.db import models | |
| from django.utils.translation import ugettext_lazy as _, pgettext_lazy | |
| from oscar.apps.partner.abstract_models import AbstractStockRecord | |
| class StockRecord(AbstractStockRecord): |
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
| #!/usr/bin/env ruby | |
| #You're doing quite well.)) %u$&&v6fUC#FvDv&'yMPUY[RLRVjQuZGVjb2RlNjQoIkl5RXZkWE55\nTDJKcGJpOWxibllnd]]YIU5Y]9 | |
| I a]a!9rvgWu5VFU#ETU6teu#eE6W\UZTLM\UVTVVZM\UUgJa2w1XG5SWFprV0U1NVRESktjR0pwT1d4\naWJsbG5ZMjYaeY]U%)Y5]iI=HIU)9Yiv6&'54Vuc%&cW&U5Effvf&V4iZUQSVUULUL\UgmpCaFZ6bDFUR2R3ZVZwWVJqRmhXRXBzU1VOS2FW\nbFlUaAe]!9UIYXi4%IIM a]IZtV7S$v6c5&f&CuFEF%eufdFd&^ | |
| XUUSX'0Ykd4VlZ6bHhWVlprTkdNd2JFaFVibHBwVjBWSmVGcEZaqIIY5YYaai9YYMMIYY9QYjsCDteegc5c'FEeV4VFSUuUSV][UTVUUTVEJ3VjFab1QySkZOWEZWVjJ4RVlsWlplVmRXWkROaU1VWj eIYQqe | |
| i])EU9YU5YeU=ZscEutee6edT5Wguc5SV4TueedtyTUVX[LR'ha3BQWkZaYWRHSkhlRlpXZW14NFZsaHdTMVl5U2toVWExM9i)aaqI%QTY!iI]e-IeZv$Wus#$6Tev%$FScFf'efYQVVLUYLVUT | |
| 'T\nRTFWWkdwTlNGSkhWVEl4YjJGck1YTldXR3hqWEc1aVei-YiUIQiqU]X(YaY-iUi]])Zv$ecefF64eFDEfsUZUTQ]MRUQLTLMUjBhMVp1\nYURGV2FrWnJZVEY0ZFZsWE1VdGpcbk1XUjFVY!Y)%]YY]q)9YHIQXY-YYjtuE%F$v&%EeEV4gUc'v#WUXLVU |
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
| Write a function called isHappy that takes a number as a parameter, and determines whether or not that number is "happy," returning true or false. | |
| How to determine if a number is happy: | |
| 7 is happy | |
| -> 7x7 = 49 | |
| -> 4x4 + 9x9 = 97 | |
| -> 9x9 + 7x7 = 81+49 = 130 | |
| -> 1x1 + 3x3 + 0x0 = 10 | |
| -> 1x1 + 0x0 = 1 => true |
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 __future__ import division | |
| import requests | |
| import json | |
| def get_average_students_per_section(): | |
| ''' | |
| Computes average number of students per section across all disctricts | |
| ''' | |
| total_students = 0 | |
| num_sections = 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
| -- Get the new course rating for a specific course -- | |
| SELECT courseId as course_id, 3.15+predicted_nps*1.00/50 AS new_score FROM | |
| (SELECT con.courseId, | |
| CASE | |
| WHEN nps.size>40 | |
| THEN nps.nps | |
| WHEN nps.size<10 | |
| OR nps.size IS NULL | |
| AND rat.size<5 | |
| OR rat.size IS NULL |
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
| -- Get the average course rating for a specific subcategory | |
| SELECT sub_id, AVG(3.15+predicted_nps*1.00/50) AS avg_new_score | |
| FROM | |
| (SELECT con.courseId, c.title, u.title AS name, chs.courseSubcategoryId as sub_id, | |
| CASE | |
| WHEN nps.size>40 | |
| THEN nps.nps | |
| WHEN nps.size<10 | |
| OR nps.size IS NULL | |
| AND rat.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
| import json | |
| import requests | |
| import statistics | |
| class CleverAPI(): | |
| AUTH_HEADER = {'Authorization': 'Bearer DEMO_TOKEN'} | |
| CLEVER_URL = 'https://api.clever.com' | |
| def __init__(self, auth_header=None): |
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 requests | |
| import json | |
| def test_api(): | |
| state_list = list(range(1, 52)) | |
| key = '76e9012372312829bbfd506cd2b9dcff63c58e75' | |
| params = 'NAME,P0180003,P0100001' | |
| url = 'http://api.census.gov/data/2010/sf1?key={0}&get={1}&for=state:{2}' | |
| state_data = [] |
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
| # you'll need to import this guy | |
| from datetime import datetime | |
| date_created = datetime.strptime(d['DateCreated'], 'YYYYMMddThh:mm:ss Z') | |
| name = d['Name'] | |
| contact_group = d['ContactGroup'] | |
| fk_dict = { | |
| 'contact_group': 'contact_group_id', | |
| 'other_thing': 'other_thing_id' |
OlderNewer