This file contains 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
RSpec.configure do |config| | |
config.before(:suite) { Coverage.start(oneshot_lines: true) } | |
config.after :suite do | |
coverage_data = Coverage.result(stop: true, clear: true) | |
uncovered_lines(coverage_data) | |
end | |
end | |
def parse_git_diff(base_branch) | |
diff_output, _stderr, _status = Open3.capture3("git diff #{base_branch} --unified=0") |
This file contains 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
# frozen_string_literal: true | |
run "heroku create #{@app_name}" | |
gem "pg" | |
file "config/database.yml", <<~CODE | |
development: &psql | |
adapter: postgresql | |
database: #{@app_name} | |
pool: 5 |
This file contains 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 functools, itertools, random, math | |
from sympy.combinatorics import Permutation | |
def cycle_rounds(p1, p2, verbose = False): | |
'''detect all cycles in p1 how many times rounded in p2 | |
Usage: | |
>>> p = Permutation(10)(2,3,4,5)(6,7) | |
>>> cycle_rounds(p,p**3) | |
[(1, 2), (3, 4)] |
This file contains 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
# A template to run ubuntu using vmType: vz instead of qemu (Default) | |
# This template requires Lima v0.14.0 or later and macOS 13. | |
vmType: "vz" | |
rosetta: | |
# Enable Rosetta for Linux. | |
# Hint: try `softwareupdate --install-rosetta` if Lima gets stuck at `Installing rosetta...` | |
enabled: true | |
# Register rosetta to /proc/sys/fs/binfmt_misc | |
binfmt: true |
This file contains 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
function dive | |
set repo $argv[1] | |
if test -z (echo $repo | cut -d '/' -f3) | |
set repo github.com/$repo | |
end | |
set path ~/repos/$repo | |
if test -d $path | |
cd $path | |
echo "Moved to existing directory $path" |
This file contains 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
require 'benchmark' | |
require 'json' | |
require 'active_support/notifications' | |
require 'active_support/cache' | |
array = (1..1000).map { rand } | |
TIMES = 1000 | |
Benchmark.bmbm do |x| | |
cache = ActiveSupport::Cache::FileStore.new("./tmp/cache") |
This file contains 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 ConstructorArgs { | |
namespace: string[] = ["default", "values"] | |
} | |
class Base extends ConstructorArgs { | |
constructor(opts: ConstructorArgs = new ConstructorArgs) { | |
super() | |
Object.assign(this, opts) | |
} | |
} |
This file contains 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
# views/fields/belongs_to_scoped/_form.html.erb | |
<div class="field-unit__label"> | |
<%= f.label field.permitted_attribute %> | |
</div> | |
<div class="field-unit__field"> | |
<%= f.select(field.permitted_attribute) do %> | |
<%= options_for_select(field.associated_resource_options(f.object.send("#{field.name}_candidates")), field.selected_option) %> | |
<% end %> | |
</div> |
This file contains 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
#include <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#define N 16 | |
#define M 16 | |
#define NN 2 | |
unsigned char x0[N]={0}; |
This file contains 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
#include <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#define N 16 | |
#define M 16 | |
#define NN 2 | |
unsigned char xx[N]; |
NewerOlder