Skip to content

Instantly share code, notes, and snippets.

peakpg

Block or report user

Report or block peakpg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peakpg
peakpg / gist:5254600
Last active Dec 15, 2015
How the Content API will behave in 4.0
View gist:5254600
# 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
@peakpg
peakpg / gist:5249564
Last active Dec 15, 2015
Expectionations for working with Content Blocks
View gist:5249564
# 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")
View gist:5091239
$(function () {
$('.countdown').click(function () {
$("#main").hide();
$("#hud").hide();
$("body").removeClass("game").addClass("gameover");
$("#gameover-container").show();
});
});
View school.rb
# 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
@peakpg
peakpg / gist:2776664
Created May 23, 2012
Upgrade BrowserCMS Module to 3.5.x (cliffnotes version)
View gist:2776664
$ echo "rvm use 1.9.3@r3.2" > .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")
@peakpg
peakpg / Gemfile
Created May 14, 2012 — forked from ylluminate/Gemfile
Example BrowserCMS (v3.5.0) Gemfile for Heroku
View Gemfile
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'
View gist:1173438
gem 'json', '= 1.1.3'
require 'json'
module Watchdox
class API
BASE_URL = "https://api.watchdox.com"
API_VERSION = "1.0"
attr_accessor :ssid
View gist:929652
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;
You can’t perform that action at this time.