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
# Case A | |
case_a = Cms::HtmlBlock.new(name: "Case A") | |
case_a.save | |
assert case_a.published? == true | |
# Case B | |
case_b = Cms::HtmlBlock.new(name: "Case B") | |
assert case_b.publish == false | |
assert case_b.persisted? == false |
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
# What would you expect to happen in each of these cases? (Don't test, just what you expect should happen) | |
# Case A | |
case_a = Cms::HtmlBlock.new(name: "Case A") | |
case_a.save | |
# Is this block in draft or published mode? | |
# Case B | |
case_b = Cms::HtmlBlock.new(name: "Case B") |
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 () { | |
$('.countdown').click(function () { | |
$("#main").hide(); | |
$("#hud").hide(); | |
$("body").removeClass("game").addClass("gameover"); | |
$("#gameover-container").show(); | |
}); | |
}); |
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
# Implementing http://beust.com/weblog/2013/02/13/coding-challenge-light-edition in Ruby | |
# Contract for eql? and hash as per: http://stackoverflow.com/questions/2328685/how-to-make-object-instance-a-hash-key-in-ruby | |
class School | |
attr_accessor :name, :nickname | |
def initialize(name, nickname) | |
self.name = name | |
self.nickname = nickname | |
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
$ echo "rvm use [email protected]" > .rvmrc | |
$ cd .. & cd bcms_module_dir | |
$ bcms-upgrade module | |
# Update gemspec to add the following: | |
spec.files = Dir["{app,config,db,lib}/**/*"] | |
spec.files += Dir["Gemfile", "LICENSE.txt", "COPYRIGHT.txt", "GPL.txt" ] | |
spec.test_files += Dir["test/**/*"] | |
spec.test_files -= Dir['test/dummy/**/*'] | |
spec.add_dependency("browsercms", "< 3.6.0", ">= 3.5.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
source 'https://rubygems.org' | |
gem 'sqlite3', :group=>:development | |
gem 'pg', :group=>:production | |
gem 'thin' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do | |
gem 'sass-rails', '~> 3.2.3' |
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
gem 'json', '= 1.1.3' | |
require 'json' | |
module Watchdox | |
class API | |
BASE_URL = "https://api.watchdox.com" | |
API_VERSION = "1.0" | |
attr_accessor :ssid |
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
private String encodeToMD5(String message) throws java.io.UnsupportedEncodingException, NoSuchAlgorithmException{ | |
byte[] bytesOfMessage = message.getBytes("UTF-8"); | |
MessageDigest md = MessageDigest.getInstance("MD5"); | |
byte[] messageDigest = md.digest(bytesOfMessage); | |
BigInteger number = new BigInteger(1, messageDigest); | |
String hashtext = number.toString(16); | |
// Now we need to zero pad it if you actually want the full 32 chars. | |
while (hashtext.length() < 32) { | |
hashtext = "0" + hashtext; |