In programming languages, literals are textual representations of values in the source code. This is a syntactical concept.
Some examples:
7 # integer literal
In programming languages, literals are textual representations of values in the source code. This is a syntactical concept.
Some examples:
7 # integer literal
Add the following to application.rb
:
$icallbacks = []
$icallbacks.define_singleton_method(:print) do
puts sort_by { |(a, b)| -b }.map { |(a, b)| "#{b}\t\t#{a}" }.join("\n")
end
ActiveSupport::Notifications.subscribe("load_config_initializer.railties") do |event|
$icallbacks << [event.payload[:initializer], event.duration]
--- Setup | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
DROP TABLE IF EXISTS planner_checksums CASCADE; | |
CREATE TABLE IF NOT EXISTS planner_checksums ( | |
identifiers_checksum uuid, | |
attributes_checksum uuid, | |
version INT | |
); | |
CREATE INDEX planner_checksums_idx ON planner_checksums(identifiers_checksum); |
This example demonstrates how we can cache the response fragments in graphql-ruby.
Existing solutions only allow caching resolved values but not all the GraphQL machinery (validation, coercion, whatever).
Caching response parts (in case of Ruby, sub-Hashes) is much more efficient.
upstream grpcservers { | |
server 0.0.0.0:50051; | |
server 0.0.0.0:50052; | |
} | |
server { | |
listen 50050 http2; | |
server_name localhost; | |
access_log /var/log/nginx/grpc_log.json; |
GC benchmarks for trunk vs gc-compact seem to be about the same:
$ make benchmark ITEM=gc
./revision.h unchanged
/Users/aaron/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \
--executables="compare-ruby::/Users/aaron/.rbenv/shims/ruby --disable=gems -I.ext/common --disable-gem" \
--executables="built-ruby::./miniruby -I./lib -I. -I.ext/common -r./prelude --disable-gem" \
Feedback loop speed in one of the biggest contributing factors to overall development time. The faster you get results, the faster you can move on to other things. A fast enough test suite is therefore critical to teams' success, and is worth investing some time at the beginning to save in the long run.
Below is a list of techniques for speeding up a Rails test suite. It is not comprehensive, but should definitely provide some quick wins. This list of techniques assumes you're using minitest
, but most everything should translate over to rspec
by simply replacing test/test_helper.rb
with spec/spec_helper.rb
.
module ApplicationPolicy | |
READ = :read | |
MANAGE = :manage | |
MANAGE_FIELD = { parent_role: MANAGE } # NOTE(rstankov): Used for GraphQL fields | |
UPDATE = :update | |
MODERATE = :moderate |
class Object | |
def defer(method, *args) | |
@current_fibers ||= [] | |
@tracepoint ||= TracePoint.trace(:return) do |tp| | |
@current_fibers.reverse_each do |fib| | |
fib.resume | |
end | |
end | |
@current_fibers << Fiber.new do |
This hooks will remind you to reference task in your commit, and remember your task ref for branch. Your commit messages will have style "[reference] message"
[PROJECT_ROOT]/hooks/prepare-commit-msg.rb
and [PROJECT_ROOT]/hooks/post-checkout.rb
[PROJECT_ROOT]/hooks/prepare-commit-msg.rb
):#!/usr/bin/env ruby