Skip to content

Instantly share code, notes, and snippets.

Avatar

Xavier Noria fxn

View GitHub Profile
View Dockerfile
FROM ubuntu:latest
# See https://github.com/oracle/truffleruby/blob/master/tool/docker-configs.yaml.
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
make \
gcc \
libssl-dev \
libz-dev \
ca-certificates \
aria2
View forked_specs.rb
module ForkedSpecs
def forked_specs(*specs)
ActiveRecord::Base.clear_all_connections!
pids = []
specs.each do |spec|
pids << fork do
ActiveRecord::Base.establish_connection
spec.call
end
View back.html
<div class="card"><div class="content">{{Back}}</div></div>
View user_test.rb
require 'test_helper'
class UserTest < ActiveSupport::TestCase
test "class names" do
uid = User.object_id
print "please modify the file and press ENTER "; gets
assert_equal uid, User.object_id
end
end
View reset-docker.sh
#!/bin/bash
docker container ls -a -q | xargs docker container rm
docker image ls -a -q | xargs docker image rm
docker volume ls -q | xargs docker volume rm
docker network ls -q --filter type=custom | xargs docker network rm
View Overview of the Zeitwerk integration in Rails 6.md
View compare_tz_env_var.rb
require "benchmark/ips"
Benchmark.ips do |x|
x.report("without TZ") do |n|
ENV["TZ"] = nil
i = 0
while i < n
Time.now
i += 1
View wdrift.c
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
int main(void)
{
struct timeval now;
double seconds;
gettimeofday(&now, NULL);
View m.ex
defmodule M do
@x N.f()
end
View strip_elixir_docs.sh
find . -name '*.ex' -or -name '*.exs' | xargs perl -ni -le 'print unless /^\s*(\@doc|\@moduledoc) """/ ... /^\s*"""/'
You can’t perform that action at this time.