Skip to content

Instantly share code, notes, and snippets.


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 / gist:5254600
Last active Dec 15, 2015
How the Content API will behave in 4.0
View gist:5254600
# Case A
case_a = "Case A")
assert case_a.published? == true
# Case B
case_b = "Case B")
assert case_b.publish == false
assert case_b.persisted? == false
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 = "Case A")
# Is this block in draft or published mode?
# Case B
case_b = "Case B")
View gist:5091239
$(function () {
$('.countdown').click(function () {
View school.rb
# Implementing in Ruby
# Contract for eql? and hash as per:
class School
attr_accessor :name, :nickname
def initialize(name, nickname) = name
self.nickname = nickname
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 / Gemfile
Created May 14, 2012 — forked from ylluminate/Gemfile
Example BrowserCMS (v3.5.0) Gemfile for Heroku
View Gemfile
source ''
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
attr_accessor :ssid
View gist:929652
private String encodeToMD5(String message) throws, 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.