Skip to content

Instantly share code, notes, and snippets.

View gist:0d1b71f12a27a89bc67760f7771c83cc
biorails@biorails-dev4:~/work/slow_time_strategy$ gem install gosu -v '1.2.0' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR: Error installing gosu:
ERROR: Failed to build gem native extension.
current directory: /home/biorails/.rvm/gems/ruby-2.5.8/gems/gosu-1.2.0/ext/gosu
/home/biorails/.rvm/rubies/ruby-2.5.8/bin/ruby -I /home/biorails/.rvm/rubies/ruby-2.5.8/lib/ruby/site_ruby/2.5.0 -r ./siteconf20211018-31439-1f4179y.rb extconf.rb
The Gosu gem requires some libraries to be installed system-wide.
See the following site for a list:
https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux
View gist:e05f430a9944dd6a2e481bfb7016fde8
ReferenceError: bid is not defined
at module.exports.play_hand (/home/biorails/work/nose_poker/src/clients/imported/nurator/_adaptive__bot.js:39:33)
at Ogre.play_hand (/home/biorails/work/nose_poker/src/models/ogre.js:19:17)
at /home/biorails/work/nose_poker/src/models/game.js:40:12
at Array.forEach (<anonymous>)
at Game.play_hand (/home/biorails/work/nose_poker/src/models/game.js:39:23)
at new Game (/home/biorails/work/nose_poker/src/models/game.js:14:12)
at Object.<anonymous> (/home/biorails/work/nose_poker/script/play_game.js:2:1)
View raze_entry.js
module.exports = class {
constructor(controller, utils) {
this.controller = controller;
this.side = controller.side;
this.utils = utils;
}
turn() {
let p = this.controller.pieces()[0];
let m = this.controller.check_space(p.x, p.y).moves[0] || false;
@AJFaraday
AJFaraday / strip_search.js
Created May 17, 2021
Conversion template?
View strip_search.js
class StripSearch {
static months = {
'01': 'January',
...
}
static setup_events() {
document.getElementById("query").addEventListener('keyup', StripSearch.run_search);
}
@AJFaraday
AJFaraday / kendo-tree-list.js
Created Mar 26, 2021
What am I doing wrong
View kendo-tree-list.js
var FolderTree = {
init: function (target_div) {
var me = this;
me.data_source = new kendo.data.TreeListDataSource(
{
transport: {
read: {
url: "/folder/elements",
@AJFaraday
AJFaraday / dec_bin.rb
Created Oct 1, 2020
The search for a Deciam Binary Two Bit Number™️
View dec_bin.rb
# Two bit numbers
require 'active_support'
def has_two_bits?(s)
r = false
b = 0
c = s.chars.sort
c[-3] != '1' && c[-2] == '1'
end
@AJFaraday
AJFaraday / ultimate_monkey_patch.rb
Created Sep 28, 2020
Possibly the best monkey patch I've ever written
View ultimate_monkey_patch.rb
class NilClass
def method_missing(m, *args, &block)
if [String, Integer, Float, Time].any?{|kls| kls.method_defined?(m)}
nil
else
super
end
end
end
@AJFaraday
AJFaraday / challenge.txt
Last active Apr 8, 2020
Easter Bunny challenge
View challenge.txt
Easter Bunny Hunting:
setup
A square grid 99 x 99
4 egg hunters, one at each corner.
Easter bunny in the middle (it has 100 eggs)
Hunters:
They are run by an array of functions
@AJFaraday
AJFaraday / notap.rb
Created Apr 2, 2020
Overuse of tap? - which is better?
View notap.rb
class SomeClass
def do_things
thing_one
thing_two
thing_three
end
def thing_one
do_something
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