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
# Test out a complex relation in the Rails console | |
t = Team.find(10004) | |
t.class.has_one :file, class_name: 'ProjectAsset', foreign_key: :parent_id, primary_key: :project_element_id | |
t.file |
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
if(api.turn() == 0) { | |
api.towardsX() | |
} else if (api.turn() == 1) { | |
api.towardsY() | |
} else { | |
var dirs = ['awayX', 'awayY', 'towardsX', 'towardsY'] | |
if (typeof api.dir == 'undefined') { | |
api.dir = 0; | |
} | |
if ((api.turn() + 1) % 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
// grabbed from gist | |
if((api.turn() % 10) == 0) { | |
directions = ['towardsY', 'towardsX', 'awayY', 'awayX']; | |
dir = Math.floor(Math.random() * 4); | |
api[directions[dir]](); | |
} |
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 Wat | |
def fine | |
foo | |
end | |
def not_fine | |
self.foo | |
end | |
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
decimal binary | |
1 000000000 + + + + + + + + = = £0.00 | |
2 000000001 + + + + + + + + 1 = 1 = £0.01 | |
3 000000010 + + + + + + + 2 + = 2 = £0.02 | |
4 000000011 + + + + + + + 2 + 1 = 3 = £0.03 | |
5 000000100 + + + + + + 5 + + = 5 = £0.05 | |
6 000000101 + + + + + + 5 + + 1 = 6 = £0.06 | |
7 000000110 + + + + + + 5 + 2 + = 7 = £0.07 | |
8 000000111 + + + + + + 5 + 2 + 1 = 8 = £0.08 | |
9 000001000 + + + + + 10 + + + = 10 = £0.10 |
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
if ((api.turn() % 2) == 0) { | |
api.towardsY(); | |
} else { | |
api.towardsX(); | |
} |
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
// Named for Alan Faraday, elder brother of game creator. | |
if (api.turn() < 30) { | |
api.awayY(); | |
} else if (api.turn() < 60) { | |
api.awayX(); | |
} else { | |
if (api.turn() % 54 < 27) { | |
api.towardsY(); | |
} else { | |
api.towardsX(); |
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
if (typeof this.n === 'undefined') { | |
this.n = 0; | |
} else { | |
this.n = (this.n + 1) % 4 | |
} | |
if((api.turn() % 3) == 0) { | |
directions = ['towardsY', 'towardsX', 'awayY', 'awayX']; | |
api[directions[this.n]](); | |
} |
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
if((api.turn() % 10) == 0) { | |
directions = ['towardsY', 'towardsX', 'awayY', 'awayX']; | |
dir = Math.floor(Math.random() * 4); | |
api[directions[dir]](); | |
} |
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
directions = ['towardsY', 'towardsX', 'awayY', 'awayX']; | |
dir = Math.floor(Math.random() * 4); | |
api[directions[dir]](); |