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 Image | |
include DataMapper::Resource | |
include FilesHelper | |
belongs_to :gallery, :required => true | |
has 1, :user, :through => :gallery | |
# property <name>, <type> | |
property :id, Serial | |
property :name, String |
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 upload(file) | |
require 'fileutils' | |
# Get upload path and create it if needed | |
file_dir = self.user.get_file_dir | |
FileUtils.mkdir_p(file_dir) | |
filename = file.original_filename | |
tmpfile = file.tempfile | |
# Write the file with a unique filename |
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> | |
var size = 25; | |
var spaces = 6; | |
var row=0; | |
// Make spaces string | |
spaces = new Array(spaces).join(" "); | |
// loop through row | |
while(row < size){ |
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
<div id="a"></div> | |
<script> | |
var size = 25; | |
// loop through row | |
for(var row=0; row <= size; row++){ | |
// loop through column | |
for(var column=0; column <= size; column++){ |
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
<div id="a"></div> | |
<script> | |
var size = 5; | |
// loop through row | |
for(var row=0; row <= size; row++){ | |
// loop through column | |
for(var column=0; column <= size; column++){ |
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
<div id="a"></div> | |
<script> | |
var size = 20; | |
// loop through row | |
for(var row=0; row < size; row++){ | |
// loop through column | |
for(var column=0; column < size; column++){ |
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
Editor.ElementView = Em.View.extend({ | |
classNameBindings: ['isSelected'], | |
/* | |
isSelected: false, | |
selectedElementChanged: Em.observer(function(){ | |
var selectedElement = Editor.selectedElementController.get('content'); | |
var isSelected = selectedElement == this.get('content'); | |
this.set('isSelected', isSelected); |
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
Editor.ElementView = Em.View.extend({ | |
classNameBindings: ['isSelected'], | |
isSelected: false, | |
selectedElementChanged: Em.observer(function(){ | |
var selectedElement = Editor.selectedElementController.get('content'); | |
var isSelected = selectedElement == this.get('content'); | |
this.set('isSelected', isSelected); | |
}).observes('Editor.selectedElementController.content'), |
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 Editor = Em.Application.create(); | |
/* | |
* | |
* Models | |
* |
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
/* | |
* | |
* Models | |
* | |
*/ | |
Editor.Element = Em.Object.extend({ | |
type: 'element', | |
name: 'something', | |
position: {x:0, y:0}, | |
size: {width:0, height:0}, |