nasm -f elf64 -g rpn.asm -o rpn.o
ld rpn.o -o rpn
./rpn
Output
class CalculateShippingCost < Operation | |
def initialize(order) | |
@order = order | |
end | |
def perform | |
validation_result = validate_address | |
return validation_result if validation_result.failure? | |
calculate_shipping_cost |
// Post: https://x.com/VictorTaelin/status/1854326873590792276 | |
// Note: The atomics must be kept. | |
// Note: This will segfault on non-Apple devices due to upfront mallocs. | |
#include <stdint.h> | |
#include <stdatomic.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> |
class Node: | |
def __init__(self, value, left=None, right=None): | |
self.value = value | |
self.left = left | |
self.right = right | |
def invert_binary_tree(root): | |
if root: | |
stack = [root] |
// go mod init queues | |
// go mod tidy | |
// go get github.com/stretchr/testify/assert | |
// go mod tidy | |
// go test background_job_test.go | |
package queues | |
import ( | |
"fmt" |
# The idea here is to make all the methods below accessible through the module | |
# itself and through the classes including the module, but having the methods | |
# publicly available both as instance and as class methods. | |
module A | |
def self.abc = 123 | |
def self.xyz = 456 | |
def self.append_features(klass) | |
methods_being_added = singleton_methods - [:append_features] | |
delegation_setter = ->(mod, methods) { delegate *methods, to: mod } |
module Graphql | |
class Utils | |
CONTEXT_CLASS = GraphQL::Query::Context | |
FIELD_CLASS = GraphQL::Language::Nodes::Field | |
FRAGMENT_CLASS = GraphQL::Language::Nodes::FragmentSpread | |
# Given a GraphQL context (literally, the +context+ method from inside any GraphQL field | |
# method), this method will return all the fields requested in the operation request. | |
# So, considering the following query example: | |
# |
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "json_pure" | |
gem "benchmark-ips" | |
end |
require 'net/http' | |
require 'json' | |
require 'cgi' | |
def delimiter(number) | |
number.reverse.scan(/.{1,3}/).join(',').reverse | |
end | |
while (true) do | |
uri = URI('https://resultados.tse.jus.br/oficial/ele2022/544/dados-simplificados/br/br-c0001-e000544-r.json') |
class Mecha | |
private attr_accessor(:states_map, :callbacks, :transitions, :current_state) | |
public :transitions, :current_state | |
def initialize(initial_state:, transitions:) | |
self.states_map = transitions.parameters.select { |(type, _)| type == :keyreq }.to_h { [_2, _2] } | |
self.callbacks = Hash.new { |hash, key| hash[key] = [] } | |
self.transitions = transitions.call(**states_map).transform_values(&:freeze).freeze |