Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
hacking away on notebook.ai

Andrew Brown drusepth

💭
hacking away on notebook.ai
View GitHub Profile
View hoverboard_controller.cs
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class HoverboardController : MonoBehaviour
{
public float multiplier; // How much force to exert on the ground to keep afloat
// This would be super cool to lerp off hoverboard battery level
// Potential game loop: find batteries?
View stack.cs
public class CardColumnManager : MonoBehaviour
{
public Stack<GameObject> card_stack;
void Start()
{
card_stack = new Stack<GameObject>();
}
public void AddCard(GameObject card)
View novelgens-promptgen-mar-24.py
import random
import re
#@title Prompt Settings
adjective = [
'Fierce', 'Scary', 'Interesting', 'Novel', 'Furry', 'Long-haired', 'Short-haired',
'Electric', 'Plasma', 'Humanoid', 'Insectoid', 'Alien', 'Tundra', 'Siberian', 'Ancient',
'Gigantic', 'Tiny', 'Small', 'Large', 'Oversized', 'Wild', 'Shadowy', 'Evil', 'Angelic',
'Good', 'Holy', 'Crystalline', 'Impressive', 'Cute', 'Kawaii', 'Celestial', 'Chibi',
'Anime', 'Manga', 'Live-action', 'Japanese', 'Western', 'Eastern', 'Zombified', 'Immortal',
View old-prompts-gen.py
import random
import re
#@title Prompt Settings
adjective = [
'Fierce', 'Scary', 'Interesting', 'Novel', 'Furry', 'Long-haired', 'Short-haired',
'Electric', 'Plasma', 'Humanoid', 'Insectoid', 'Alien', 'Tundra', 'Siberian', 'Ancient',
'Gigantic', 'Tiny', 'Small', 'Large', 'Oversized', 'Wild'
]
View tk.rb
#!/usr/bin/ruby
require 'cinch'
require 'net/http'
require 'uri'
bot = Cinch::Bot.new do
configure do |c|
c.nick = "TK"
c.realname = "TK"
View tiamat.rb
require 'ruby2d'
BUILD = :DEVELOPMENT
set title: 'Tiamat',
background: 'blue',
width: 640, viewport_width: 640,
height: 480, viewport_height: 480,
resizable: false,
borderless: BUILD == :PRODUCTION,
fullscreen: BUILD == :PRODUCTION,
View perflog.rb
require 'pry'
# APPROACH 1
module PerfLogger
def perflog(func_name)
new_name_for_old_function = "#{func_name}_old".to_sym
alias_method(new_name_for_old_function, func_name)
define_method(func_name) do |*args|
puts "about to call #{func_name}(#{args.join(', ')})"
View perflog.rb
require 'pry'
# APPROACH 1
module PerfLogger
def perflog(func_name)
new_name_for_old_function = "#{func_name}_old".to_sym
alias_method(new_name_for_old_function, func_name)
define_method(func_name) do |*args|
puts "about to call #{func_name}(#{args.join(', ')})"
View mutate.rb
def function_snapshot_from_passing_tests(n)
return n if (0..1).include?(n)
(function_snapshot_from_passing_tests(n - 1) + function_snapshot_from_passing_tests(n - 2))
end
def regressed_function(n)
return n if (0...1).include?(n)
(regressed_function(n - 1) + regressed_function(n - 2))
View sql.rb
# {
# characters: [...],
# locations: [...]
# }
def content(
content_types: Rails.application.config.content_types[:all].map(&:name),
page_scoping: { user_id: self.id },
universe_id: nil
)
return {} if content_types.empty?