Skip to content

Instantly share code, notes, and snippets.

naufragio del desastre linda metafísico de producción oncall compwron

Block or report user

Report or block compwron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bad_cache.rb
thing1 = { data: 'data1', size: 10 }
thing2 = { data: 'data2', size: 20 }
thing3 = { data: 'data3', size: 5 }
require 'time'
require 'ap'
class Cache
def initialize(size:)
@size = size
@things = []
@locations = {} # key: @things pointer
@compwron
compwron / tictactoe.rb
Created Apr 28, 2019
incomplete tictactoe
View tictactoe.rb
# frozen_string_literal: true
class TicTacToe
class SpotTaken < StandardError
end
SIZE = 3
DEFAULT = '-'
def initialize
@compwron
compwron / ymlfind.rb
Last active Dec 20, 2018
Find the line number of a key in a long yaml file
View ymlfind.rb
#!/usr/bin/ruby
# frozen_string_literal: true
require 'yaml'
to_find = ARGV[0]
puts "Finding #{to_find}"
parts = to_find.split('.')
filename = 'config/locales/en.yml'
@compwron
compwron / queue-example.rb
Created Dec 14, 2017
simple queue demo code
View queue-example.rb
# Design & implement an API that allows us to offload work into a queue, as well
# as consume and complete jobs on the queue. The API should provide the following
# functionality:
#
# 1) enqueue a job, which would consist of a job type and parameters
#
# 2) register something to handle jobs of a specific type
# (e.g. this could be a callback or class)
#
# 3) execute all jobs in the queue
View SafeCommitGradlePlugin.java
package com.example.gradleplugin
import com.google.common.io.Resources
import org.ajoberstar.grgit.Grgit
import java.nio.charset.Charset
class PreCommitHooks {
public static final String HOOK_PATH = '.git/hooks/'
public static final String COMMIT_MSG_HOOK_PATH = HOOK_PATH + 'commit-msg'
@compwron
compwron / flowify.sh
Last active Dec 29, 2017
gradle task for ratcheting flow percentage in js codebase
View flowify.sh
#!/usr/bin/env bash
files_with_flow=`grep -r @flow web-src/src | wc -l | sed 's#^ *##g'` # sed removes leading whitespace
total_js_files=`find web-src/src -name *.js -type f | wc -l | sed 's#^ *##g'`
echo "Files with flow: "$files_with_flow
echo "Total js files: "$total_js_files
source previous_flowify_counts.sh
echo "Previous percentage flowified: "$PREVIOUS_FLOWIFY_PERCENTAGE
View hard_questions_for_recruiters.txt
Even though some of these questions don't affect me directly, I consider them excellent indicators of whether a company is somewhere that I want to work at, because I would not like to work at a place where I wouldn't be able to be proud of.
(In approximate order of liklihood that a company will make me sad)
Does the company offer trans healthcare? How do you stack up against the https://www.hrc.org/hei/hei-scoring-criteria checklist?
What is your parental leave policy?
Would I be the only woman developer on the team?
What is your policy/approach/guidelines on contributing back to open source software projects?
What is the team like? Number, composition, specialties? Do they do pull requests or push to master, what are their favorite conferences, is there an on call rotation? :)
@compwron
compwron / clearable-material-ui-date-picker.js
Created Aug 31, 2017
clearable-material-ui-date-picker.js
View clearable-material-ui-date-picker.js
// credit to Michael Lennon
import React, {Component, button} from "react";
import PropTypes from "prop-types";
import DatePicker from "material-ui/DatePicker";
import moment from "moment-timezone";
function DatePickerClearable({style, datePickerStyle={}, ...datePickerProps}) {
function clearBtnClickWrapper() {
datePickerProps.onChange(null, null); // (event, newValue)
View rdsfix.java
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.MigrationInfo;
import org.flywaydb.core.api.callback.BaseFlywayCallback;
import org.flywaydb.core.api.callback.FlywayCallback;
import org.flywaydb.core.api.configuration.FlywayConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer;
@compwron
compwron / testutils.java
Created Jul 9, 2017
testutils from package dragnon;
View testutils.java
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.fail;
@SuppressWarnings("unchecked")
You can’t perform that action at this time.