video = Video.first
save_method = video.method(:save)
save_method.class
# => Method
save_method.source_location
# => an Array with [file, line]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in this test, i want to define a custom N1 segment which adds an extra element to the standard N1. | |
# | |
# it seems that the code somehow continues to reference the built-in N1 definition. | |
# i see errors saying that "N1 segment has only 6 elements" (the original number of elements in N1) | |
# even when my custom N1 defines 7 elements. | |
# | |
# see lines 103-111 below for more details on the error i see. | |
require "bundler/inline" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import obspython as obs | |
obs_signal_handler = obs.obs_get_signal_handler() | |
# tested in OBS 25.0.6 on OSX. July 26, 2020. | |
def script_description(): | |
return """ | |
Debug signal_handler_disconnect. |
This script reports on how the behavior of ActiveModel::Dirty
methods have changed during various lifecycle callbacks in ActiveRecord
instances.
The report shows the output of various ActiveModel::Dirty
methods within a number of different callbacks, under different versions of ActiveRecord
.
The script used to create this output is below, and can be used/modified to get information on other dirty-state methods.
this script was kinda fun to put together. i got to poke in a few areas of ruby I don't typically touch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from locust import HttpLocust, TaskSet, task | |
class UserBehavior(TaskSet): | |
def on_start(self): | |
""" on_start is called when a Locust start before any task is scheduled """ | |
self.login() | |
def on_stop(self): | |
""" on_stop is called when the TaskSet is stopping """ | |
self.logout() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -Rf /tmp/error | |
mkdir -p /tmp/error | |
cd /tmp/error | |
cat > Gemfile <<EOF | |
source "http://rubygems.org" | |
EOF | |
rvm use 2.5.1@global | |
gem install bundler --no-ri --no-rdoc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TempModelBuilder | |
def self.build(sql, size) | |
final_table_name = "tmp_#{Digest::MD5.hexdigest(sql)}" | |
clazz = Class.new(ActiveRecord::Base) | |
clazz.table_name = final_table_name | |
# do stuff to create & populate the table | |
clazz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# None | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# HUBOT_WUNDERGROUND_API_KEY Sign up at http://www.wunderground.com/weather/api/. | |
# HUBOT_WUNDERGROUND_USE_METRIC Set to arbitrary value to use forecasts with metric system units | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language_code | name | |
---|---|---|
af | Afrikaans | |
am | Amharic | |
ar | Arabic | |
arq | Algerian Arabic | |
art-x-bork | Swedish Chef | |
as | Assamese | |
ast | Asturian | |
az | Azerbaijani | |
be | Belarusian |
NewerOlder