Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
AJFaraday / Index.html
Created December 28, 2022 13:46
Burger! By chatgpt
<!DOCTYPE html>
<html>
<head>
<title>Delicious Cheeseburgers</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<!-- Header -->
<header>
<h1>Delicious Cheeseburgers</h1>
@AJFaraday
AJFaraday / gist:0d1b71f12a27a89bc67760f7771c83cc
Created October 18, 2021 21:02
Error installing gosu gem
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
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)
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 10:48
Conversion template?
class StripSearch {
static months = {
'01': 'January',
...
}
static setup_events() {
document.getElementById("query").addEventListener('keyup', StripSearch.run_search);
}
@AJFaraday
AJFaraday / kendo-tree-list.js
Created March 26, 2021 11:13
What am I doing wrong
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 October 1, 2020 08:19
The search for a Deciam Binary Two Bit Number™️
# 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 September 28, 2020 15:53
Possibly the best monkey patch I've ever written
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 April 8, 2020 13:39
Easter Bunny challenge
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 April 2, 2020 13:17
Overuse of tap? - which is better?
class SomeClass
def do_things
thing_one
thing_two
thing_three
end
def thing_one
do_something