Skip to content

Instantly share code, notes, and snippets.

View drusepth's full-sized avatar
💭
hacking away on notebook.ai

Andrew Brown drusepth

💭
hacking away on notebook.ai
View GitHub Profile
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(', ')})"
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(', ')})"
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))
# {
# 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?
It took nearly a hundred years of social movements, radical regulation changes, and vigilantly rooting out the problem by each and every one of our friends and neighbors for us to get to this point, but the collective enthusiasm and determination that humans displayed at the end of the Last War a century prior were still just as infectious and palpable for the deactivation ceremony for the last robot: the symbolic culmination of an inconsequential war that had long since been won.
His name was Ted Williams, activated by John and Robert Williams in the year 2641, build 4F of Nalic's positronic Watchful Grandpa series. To the last event of his existence, he wore a fitted, tan pinstripe suit and the brown necktie that John and Robert had worn at their wedding, passed down to Ted after their deaths. His deprecated robotic parts squeaked and squealed as he moved; Ted had been a public figure for much of his life, but he had very publicly fallen into a debilitating depression during the Last War. He was no strange
# I have a proc that I would like to initialize a variable in scope for before it runs.
[20] pry(#<AnalyzeDocumentJob>)> [callback.class, callback.binding.class]
=> [Proc, Binding]
[21] pry(#<AnalyzeDocumentJob>)> [callback.send(:local_variables).include?(:word_count),
callback.binding.local_variables.include?(:word_count)]
=> [false, false]
# (Failed) attempts to set the variable are below
# Categories returned as a keyed hash, making for fast reference (e.g. response.categories.Overview)
"categories": {
"Overview": {
"fields": [
{
"id": 123,
"label": "Description",
"value": "Some Description"
},
{
The following is a list of writing prompts intended to flesh out characters and other things in a fictional world.
1. How did [Character A] meet [Character B]?
2. What was it like for [Character A] growing up?
3. How has [Character A]'s childhood struggles impacted them as a person long-term?
4. What would [Character A] do if they found a bag of money on the street?
ubuntu@ip-172-30-0-205:~/roleplay$ pip --version
pip 20.1.1 from /home/ubuntu/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
ubuntu@ip-172-30-0-205:~/roleplay$ pip3 --version
pip 20.1.1 from /home/ubuntu/.local/lib/python3.6/site-packages/pip (python 3.6)
ubuntu@ip-172-30-0-205:~/roleplay$ pip3 install aitextgen
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: aitextgen in /home/ubuntu/.local/lib/python3.6/site-packages (0.2.0)
Requirement already satisfied: fire>=0.3.0 in /home/ubuntu/.local/lib/python3.6/site-packages (from aitextgen) (0.3.1)
=> "SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy,universe_id FROM universes WHERE user_id = 1 AND deleted_at IS NULL AND archived_at IS NULL UNION ALL SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy,universe_id FROM characters WHERE user_id = 1 AND deleted_at IS NULL AND archived_at IS NULL AND universe_id = 2 UNION ALL SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy,universe_id FROM locations WHERE user_id = 1 AND deleted_at IS NULL AND archived_at IS NULL AND universe_id = 2 UNION ALL SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy,universe_id FROM items WHERE user_id = 1 AND deleted_at IS NULL AND archived_at IS NULL AND universe_id = 2 UNION ALL SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy,universe_id FROM buildings WHERE user_id = 1 AND deleted_at IS NULL AND archived_at IS NULL AND universe_id = 2 UNION ALL SE