This file contains 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
has_attached_file :foreground, | |
:convert_options => { | |
:background_strip => :lambda {|s| ((s.from_side == 'right') ? '-gravity NorthEast ' : '') + '-crop 10x10000+0+0'} | |
} |
This file contains 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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains 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 Animator = function(a, b) { | |
var clear_frame = true; | |
var current_frame = 0; | |
var auto_repeat = true; | |
var refresh_ms = 30; | |
var callbacks = []; | |
initialize(a, b); | |
function initialize(canvas) { | |
var self = this; |
This file contains 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
box = {x: 10, y: 10, width: 40, height: 50, vX: 5, vY: 5}; | |
bounds = {left: 0, right: 800, top: 0, bottom: 400}; | |
frame() { | |
box.nX = box.x + box.vX; | |
box.nY = box.y + box.vY; | |
if(box.nX < bounds.left) box.vX *= -1; | |
if(box.nX + box.width > bounds.right) box.vX *= -1; |
This file contains 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
def generate_tiles | |
# Pass the number of tiles into the main hash | |
tiles = { | |
ore: 3, # Ore | |
brick: 3, # Brick | |
wheat: 4, # Wheat | |
lumber: 4, # Trees | |
wool: 4, # Wool, Robber | |
robber: 1}.map { |k, v| | |
# After creating tile count, lets map them |
This file contains 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 Board < ActiveRecord::Base | |
belongs_to :game | |
# After initialize we generate new tiles and store them in the objects tiles accessor | |
# When this model is retrieved through ActiveRecord the tiles are not generated and we get the | |
# tile set that was saved in the database. | |
after_initialize :place_tiles | |
def place_tiles | |
# The tiles hash is stored in a text field, Rails handles this |
This file contains 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
// Create model extending from Spine Model | |
window.Game = Spine.Model.sub({ | |
// No documentation about this, refered to in controller documenation | |
init: function() { | |
this.players = 2; | |
} | |
}); | |
// What accessors does it have? | |
Game.configure('Game', 'players'); |
This file contains 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
window.Game = Backbone.Model.extend({ | |
// Must define this for API endpoint | |
urlRoot: '/games', | |
// Set defaults like so | |
defaults: { | |
'players': 2 | |
} | |
}); |
This file contains 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
<script type="text/x-handlebars"> | |
The President of the United States is {{MyApp.president.fullName}}. | |
</script> |
This file contains 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 TodoView = Backbone.View.extend({ | |
tagName: 'li', | |
template: _.template($('#item-template').html()), | |
// Ensure our view knows about the association to it's model | |
initialize: function() { | |
this.model.bind('change', this.render, this); | |
}, | |
// Drop that model into the template and have the template re-render |
OlderNewer