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
var canvases = []; | |
var testIndex = 0; | |
function createCanvas( level ) | |
{ | |
var canvas = document.createElement('canvas'); | |
var tests = document.getElementsByClassName( 'test' ) | |
canvas.width = 300; | |
canvas.height = 150; | |
canvas.id = canvases.length; | |
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
# Batcan Style | |
class Project | |
# permission is enforced for all create/update/save calls. It is defined within the context of its own class and is only | |
# called when this particular permission is checked. | |
permission :save do |project, user| | |
next true if user.admin? | |
next true if project.owner == user | |
next true if project.collaborators.include?(user) | |
# at this point if we haven't returned true then we dont have permission. We are allowed to return a user readable | |
# string here (not sure if CanCan has this capability, I don't see it in the docs) |
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
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below | |
# NEW WAY / EASY WAY | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.deb | |
sudo dpkg -i elasticsearch-0.90.7.deb |
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
class ApplicationController | |
helper_method :layout_options | |
def layout_options(options = nil) | |
@layout_options ||= Hashie::Mash.new( | |
title: "Default App Title", | |
menubar: true, | |
footer: true, | |
og_title: nil, | |
og_type: 'website', |
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
class Hash | |
# | |
# Makes the hash dynamic, allowing its hash values to be accessed as if they were properties on the object. | |
# | |
def make_dynamic(cascade = false, allow_dynamic_new_properties = false) | |
self.extend(DynamicAttrs) unless is_a? DynamicAttrs | |
@allow_dynamic_new_properties = allow_dynamic_new_properties | |
if cascade |