Skip to content

Instantly share code, notes, and snippets.

@peteroyle
peteroyle / gist:5315918
Created April 5, 2013 01:31
Example of Ruby's behavior when modifying properties/values of objects/hashes passed as parameters
This test passes:
it "should tell me how params are passed" do
# that new car smell
car = Car.new
car.colour = "blue"
# this car smells like hash
car_hash = {'colour' => 'blue'}
# both cars were created blue yeah?
@peteroyle
peteroyle / gist:2659283
Created May 11, 2012 12:17
Codea Achievements Framework
--# PointSizeHelper
function pointsScaled(width)
if WIDTH == 1024 then
pointRatio = WIDTH / 10000
else
pointRatio = WIDTH / 5500
end
return width * pointRatio
@peteroyle
peteroyle / gist:2652743
Created May 10, 2012 12:24
Split Screen In Codea
--# Menu
Menu = class()
function Menu:init()
end
function Menu:draw()
if self.main then
@peteroyle
peteroyle / Noise Works
Created April 12, 2012 11:53
Noise Works Codea Project
--# CircleMask
CircleMask = class()
function CircleMask:init(rad, sides)
-- you can accept and set parameters here
self.mesh = mesh()
local verts = {}
@peteroyle
peteroyle / Main
Created February 16, 2012 23:10
Rotating Sun In Codea
-- CircleMask class courtesy of Simeon (http://twolivesleft.com/Codea/Talk/profile/3/Simeon)
-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
    -- params: width, sides in mesh, texture detail, image resolution, rotation speed
    sun = Sun(WIDTH*0.5, 128, 580, 52, 0.4)
end
-- This function gets called once every frame
@peteroyle
peteroyle / myapp_app
Created December 20, 2011 02:56
Boxgrinder Embedded Ordering Samples
name: myapp_app
summary: Common configuration for running the C-Rex platform (just the application host)
post:
base:
- "echo ---- Creating home directory structures"
- "mkdir -p /home/myapp/stuff"
- "echo ---- Installing application and setting permissions"
- "chown -R myapp:myapp /home/myapp"
@peteroyle
peteroyle / BundledHelpersTest.java
Created September 8, 2011 23:22
Approach for bundeling string helpers into templates in Seam Render
public class BundledHelpersTest {
@Test
public void testStringUtils() throws Exception {
testBundledHelper("TheInpu...", "@{render.abbreviate('TheInputString', 10)}");
testBundledHelper("...putSt...", "@{render.abbreviate('TheInputString', 5, 11)}");
testBundledHelper("TheInputString", "@{render.capitalize('TheInputString')}");
testBundledHelper(" TheInputString ", "@{render.center('TheInputString', 20)}");
testBundledHelper("TheInputString", "@{render.defaultString('TheInputString', 'BlahBlah')}");
testBundledHelper("BlahBlah", "@{render.defaultString('', 'BlahBlah')}");
D, [2011-09-07T08:28:01.489667 #20442] DEBUG -- : Loading os plugins...
D, [2011-09-07T08:28:01.490619 #20442] DEBUG -- : We have 4 os plugin(s) registered
D, [2011-09-07T08:28:01.491476 #20442] DEBUG -- : - centos plugin for CentOS.
D, [2011-09-07T08:28:01.492418 #20442] DEBUG -- : - rhel plugin for Red Hat Enterprise Linux.
D, [2011-09-07T08:28:01.493452 #20442] DEBUG -- : - sl plugin for Scientific Linux.
D, [2011-09-07T08:28:01.494406 #20442] DEBUG -- : - fedora plugin for Fedora.
D, [2011-09-07T08:28:01.495450 #20442] DEBUG -- : Plugins loaded.
D, [2011-09-07T08:28:01.496466 #20442] DEBUG -- : Loading platform plugins...
D, [2011-09-07T08:28:01.497424 #20442] DEBUG -- : We have 3 platform plugin(s) registered
D, [2011-09-07T08:28:01.498449 #20442] DEBUG -- : - virtualbox plugin for VirtualBox.
name: dev_java
summary: Tools for developing Java apps
appliances:
- dev_common
- java_common
files:
"/opt":
- "http://apache.mirror.aussiehq.net.au//maven/binaries/apache-maven-3.0.3-bin.tar.gz"
- "http://bit.ly/pYsNJV"
packages:
@peteroyle
peteroyle / boxgrinder.log
Created June 28, 2011 01:52
CentOS 5 Jeos from BG nightly on Micro AMI in Singapore (AMI: boxgrinder-meta/fedora/15/1.6/x86_64 (ami-c8671f9a))
# Logfile created on Mon Jun 27 21:21:26 -0400 2011 by logger.rb/22285
D, [2011-06-27T21:21:26.810527 #869] DEBUG -- : Launching new build...
T, [2011-06-27T21:21:26.850591 #869] TRACE -- : Used configuration: --- !map:BoxGrinder::Config
:file: /root/.boxgrinder/config
:force: true
:platform_config: {}
:log_level: :info
:delivery_config: {}