Skip to content

Instantly share code, notes, and snippets.

View wisetara's full-sized avatar

Tara Scherner de la Fuente wisetara

  • Portland, OR
View GitHub Profile
package auth
import (
"context"
"net/http"
"strings"
"google.golang.org/grpc/metadata"
"github.com/andela/micro-api-gateway/pb/authorization"
@wisetara
wisetara / BugIssueTemplate.md
Created April 18, 2018 17:41
basic template for bugs

Environment where bug was observed:

  • Production
  • Staging
  • Development
  • Somewhere else:

Observations

When one does X, this happens. Instead, this should happen.

@wisetara
wisetara / deferred_garbage_collection.rb
Last active February 27, 2018 17:40
Let's speed up RSpec, yo. This Singleton version totally based on @joevandyk and @triskweline's work
class DeferredGarbageCollection
include Singleton
# One can set a different time period for the garbage collection, but 15 seemed good.
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f
def initialize
@last_gc_run = Time.zone.now
end
@wisetara
wisetara / The Technical Interview Cheat Sheet.md
Created February 11, 2018 21:14 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@wisetara
wisetara / pre-commit hook
Created February 7, 2018 04:04
pre-commit.sh
#!/bin/sh
# Git pre-commit hook that prevents accidentally committing things that shouldn't be, like:
#
# * ":focus", used with RSpec/Guard
# * "show_page", used to debug request specs
# * "console.log" or "console.debug", used in JavaScript debugging
# * "DO NOT COMMIT!" comments
#
# Modify the regexps to suit your needs. The error message shows the full regexp match,
@wisetara
wisetara / clone_dbc_repo.rb
Created December 14, 2017 14:43 — forked from user512/clone_dbc_repo.rb
clone dbc repo
require 'json'
def clone_repo
page_num = 1
loop do
# replace sf-grasshoppers-2015 with your cohort name
json = %x[curl 'https://api.github.com/orgs/sf-grasshoppers-2015/repos?per_page=100&page=#{page_num}' -u <username>:<personal_access_token>]
json = JSON.parse(json)
break if json.empty?
json.each { |repo| %x[git clone #{repo["ssh_url"]} ] }
page_num += 1
@wisetara
wisetara / hw22-3
Last active December 12, 2017 05:16
Bash script
# Write a bash script named "hw22-3" that accepts a list of inode numbers from the command line,
# and displays
# the file name and physical file system of each file with that inode number. If no
# file exists with that inode number display "no such file".
#
# EXAMPLE:
# > hw22-3 8384567 12345
# Inode "8384567" has files:
# main.cpp on /dev/mapper/system-student
#
@wisetara
wisetara / roman_numerals.js
Created August 23, 2017 06:24
Convert Arabic Numbers to Roman Numerals
var romanNumbers = [['','I','II','III','IV','V','VI','VII','VIII','IX'],
['','X','XX','XXX','XL','L','LX','LXX','LXXX','XC'],
['','C','CC','CCC','CD','D','DC','DCC','DCCC','CM']];
function convert(number) {
var romanNumeral = '';
var reversedNumber = number.toString().split('').reverse();
for (var i=0; i < digits.length; i++){
romanNumeral = romanNumbers[i][parseInt(reversedNumber[i])] + romanNumeral;
}
@wisetara
wisetara / roman_numerals_in_ruby.rb
Created August 23, 2017 06:17
Convert Arabic Roman Numbers with Ruby
class Fixnum
# Unique + special roman numerals
ROMANS = { 1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C',
90: 'XC', 50: 'L', 40: 'XL', 10: 'X', 9: 'IX',
5: 'V', 4: 'IV', 1: 'I' }.freeze
def to_roman
ROMANS[self] || divide_and_conquer_roman(self)
end