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
$ nosetests --ckan --with-pylons=test-core.ini ckan ckanext | |
.....EE.............................../usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py:2181: SAWarning: Usage of the 'related attribute set' operation is not currently supported within the execution stage of the flush process. Results may not be consistent. Consider using alternative event listeners or connection-level operations instead. | |
% method) | |
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................../usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/sql/compile |
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
====================================================================== | |
ERROR: ckanext.webpageview.tests.test_view.TestWebPageView.test_view_shown_on_resource_page | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest | |
self.test(*self.arg) | |
File "/home/cody/ckan/lib/default/src/ckan/ckan/tests/helpers.py", line 389, in wrapper | |
return func(*args, **kwargs) | |
File "/home/cody/ckan/lib/default/src/ckan/ckanext/webpageview/tests/test_view.py", line 46, in test_view_shown_on_resource_page | |
response = app.get(url) |
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
## | |
# Module to split bills evenly for a group of people (i.e. splitting cost for a pizza lunch). | |
# | |
# Basic use: | |
# `BillSplitter.split_bill(total: 82.42, people: 11)` => "Each person should fork over 7.49!" | |
module BillSplitter | |
require 'bigdecimal' | |
def self.split_bill(total: 0.00, people: 1) | |
bd_total = BigDecimal.new(total.to_s) |
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
# | |
# This is a basic implementation of compression based on Huffman coding. | |
# My main source of reference to try and implement this was the Wikipedia page [1]. | |
# Specifically the image there that explains the basic steps [2]. | |
# | |
# I was initially tasked to implmenet this and was unable to at the time. | |
# About a week later, after doing other practice coding problems and reading some more | |
# docs I decided to try it again. | |
# | |
# This took a number of hours broken over 2 days. I tried to limit google searches to only |
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
# Create rails app to see issue. | |
rails new sample | |
rails g scaffold Author name:string | |
rails g scaffold Post title:string body:text author:references | |
rails g scaffold Comment body:text post:references | |
# Update post model to add association. | |
has_many :comments |
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
# Get the encryption classes needed. Assuming they are in the same directory. | |
require './symmetric_encrypt.rb' | |
require './symmetric_decrypt.rb' | |
puts "What would you like to do?" | |
puts "Type 'encrypt', 'decrypt' or 'exit'." | |
input = gets.chomp | |
input.downcase | |
if input == 'encrypt' |
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
module WeatherChecker | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
# Setup proxy just for this. | |
# Modify this to work for your needs/setup. Remove if you aren't behind a proxy. | |
system 'export http_proxy=$https_proxy' | |
city_directory_url = 'https://weather.gc.ca/forecast/canada/index_e.html?id=ON' |