Skip to content

Instantly share code, notes, and snippets.

Andrew Faraday AJFaraday

Block or report user

Report or block AJFaraday

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9fdd8f6f879a28873cb87ec3fef449c6
# 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
View bot.js
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) {
View bot.js
// grabbed from gist
if((api.turn() % 10) == 0) {
directions = ['towardsY', 'towardsX', 'awayY', 'awayX'];
dir = Math.floor(Math.random() * 4);
api[directions[dir]]();
}
@AJFaraday
AJFaraday / wat.rb
Created Aug 14, 2019
Private methods WAT
View wat.rb
class Wat
def fine
foo
end
def not_fine
self.foo
end
View result.txt
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
View bot.js
if ((api.turn() % 2) == 0) {
api.towardsY();
} else {
api.towardsX();
}
@AJFaraday
AJFaraday / bot.js
Last active Aug 29, 2018
Faraday Cage
View bot.js
// 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();
@AJFaraday
AJFaraday / bot.js
Last active Oct 21, 2019
Rotate Bot
View bot.js
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]]();
}
@AJFaraday
AJFaraday / bot.js
Last active Aug 29, 2018
Long random bot
View bot.js
if((api.turn() % 10) == 0) {
directions = ['towardsY', 'towardsX', 'awayY', 'awayX'];
dir = Math.floor(Math.random() * 4);
api[directions[dir]]();
}
@AJFaraday
AJFaraday / bot.js
Last active Aug 29, 2018
Random Bot
View bot.js
directions = ['towardsY', 'towardsX', 'awayY', 'awayX'];
dir = Math.floor(Math.random() * 4);
api[directions[dir]]();
You can’t perform that action at this time.