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
func QuickSort(a []int32) []int32 { | |
if len(a) < 2 { | |
return a | |
} | |
// lomuto partition | |
lastIndex := len(a) - 1 | |
pivot := a[lastIndex] | |
j := -1 | |
for i := range a[:lastIndex] { |
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
# requires slim gem installed for slimrb, and brew install tidy-html5 | |
file_name=./app/views/errors/show.html.slim | |
slimrb --erb "$file_name" \ | |
| sed 's/::Temple::Utils\.escape_html((\(.*\))) %>/\1 %>/g' \ | |
| tidy -q -i \ | |
> ${file_name%.*}.erb |
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
require 'set' | |
# A short buffer that can tell you if you've encountered a value recently | |
# without taking up too much memory. | |
# It keeps track of the n last items you've met | |
class ShortMemo | |
def initialize(max_size: 10, reset_when_met: false) | |
@max_size = max_size | |
@reset_when_met = reset_when_met |
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
func (api *AppointmentServiceV1Alpha1) ListAdvisers(ctx context.Context, req *v1alpha1.ListAdvisersRequest) (*v1alpha1.ListAdvisersResponse, error) { | |
ctx = forwardGRPCMetadata(ctx) | |
grpcClient, err := api.Schoolbackoffice.Service.KnownServiceGRPCClient("appointment") | |
if err != nil { | |
return nil, grpc.InternalError("missing appointment grpc client: %v", err) | |
} | |
appointmentClient := jobteaser_appointment_v1alpha1.NewAdviserServiceClient(grpcClient.Conn) | |
listAdvisersResponse, err := appointmentClient.ListAdvisers(ctx, &jobteaser_appointment_v1alpha1.ListAdvisersRequest{ |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "hashicorp/bionic64" | |
# Disable automatic box update checking. If you disable this, then | |
# boxes will only be checked for updates when the user runs | |
# `vagrant box outdated`. This is not recommended. | |
# config.vm.box_check_update = false |
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
#!/bin/bash | |
REPO=Go-Electra/electra-backend | |
prs=$(gh pr list --state merged --repo $REPO --json createdAt,mergedAt --limit 100) | |
count=0 | |
total=0 | |
lifetimes=() |
OlderNewer