Skip to content

Instantly share code, notes, and snippets.

Viewing your learning
as a learner
I see recommended courses if I have no enrolments
Warning: Failed prop type: The prop `onBeforeFilter` is marked as required in `CourseEnrolmentFilterForm`, but its value is `undefined`.
in CourseEnrolmentFilterForm
in ContextProvider
Warning: Failed prop type: The prop `onFilter` is marked as required in `CourseEnrolmentFilterForm`, but its value is `undefined`.
in CourseEnrolmentFilterForm
in ContextProvider
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
if flow.request.pretty_url.startswith("https://www.example.net/exercise"):
flow.response = http.HTTPResponse.make(
200,
b"exercise-content",
)
elif flow.request.pretty_url.startswith("https://cdnjs.cloudflare.com/ajax/libs/mathjax"):
flow.response = http.HTTPResponse.make(
$ yarn check
yarn check v1.5.1
warning "babel-traverse#globals@^9.0.0" could be deduped from "9.18.0" to "globals@9.18.0"
error "hypernova-react#react@^0.14 || ^15 || ^16" doesn't satisfy found match of "react@16.3.0-alpha.1"
error "hypernova-react#react-dom@^0.14 || ^15 || ^16" doesn't satisfy found match of "react-dom@16.3.0-alpha.1"
error "react-autosize-textarea#react@^0.14.0 || ^15.0.0 || ^16.0.0" doesn't satisfy found match of "react@16.3.0-alpha.1"
error "react-autosize-textarea#react-dom@^0.14.0 || ^15.0.0 || ^16.0.0" doesn't satisfy found match of "react-dom@16.3.0-alpha.1"
warning "react-big-calendar#prop-types@^15.5.8" could be deduped from "15.6.0" to "prop-types@15.6.0"
error "react-big-calendar#react@^15.3.0 || ^16.0.0" doesn't satisfy found match of "react@16.3.0-alpha.1"
error "react-big-calendar#react-dom@^15.3.0 || ^16.0.0" doesn't satisfy found match of "react-dom@16.3.0-alpha.1"
require 'benchmark/ips'
Benchmark.ips do |x|
x.report('Range#include? (int)') do
(1..10_000).include?(5_000)
end
x.report('Range#cover? (int)') do
(1..10_000).cover?(5_000)
end
@urbanautomaton
urbanautomaton / benchmark.rb
Last active February 21, 2018 21:03
Perf analysis of `Performance/HashEachMethods` cop
require 'securerandom'
require 'benchmark/ips'
hash = {}
1000.times do
hash[SecureRandom.uuid] = SecureRandom.uuid
end
array = hash.to_a
@urbanautomaton
urbanautomaton / readme.markdown
Last active July 18, 2016 15:32
Username tab-completion for mynewsdesk-git-pair

If you use mynewsdesk-git-pair to manage pairing authors in git, add the following snippet to your .bashrc to enable tab completion of pairing author names.

_git_pair () {
  __gitcomp_nl "$(git config --get-all git-pair.authors | sed 's/\([^ ]*\).*/\1/')"
}

Prerequisites

@urbanautomaton
urbanautomaton / copies_to_log.sh
Created July 6, 2016 19:01
appending script output to a logfile
#!/usr/bin/env bash
exec 1> >(tee -a somefile.log) 2>&1
echo "hello"
@urbanautomaton
urbanautomaton / build_stubbed.rb
Created June 23, 2016 12:36
actually, factory_girl is extremely good
RSpec.describe 'FactoryGirl.build_stubbed' do
let(:stubbed_model) { FactoryGirl.build_stubbed(:step_progress) }
it 'doesnt allow #save' do
expect {
stubbed_model.save
}.to raise_error RuntimeError, /stubbed models are not allowed to access the database/
end
it 'doesnt allow #update_attributes' do
scss:
enabled: false
ruby:
config_file: .ruby-style.yml
javascript:
config_file: .jshintrc
302 Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
72 Extra empty line detected at block body end.
71 Extra empty line detected at block body beginning.
52 Extra empty line detected at class body beginning.
47 Final newline missing.
45 Extra empty line detected at class body end.
40 Align the operands of an expression in an assignment spanning multiple lines.
35 Extra blank line detected.
22 Trailing whitespace detected.
22 Tab detected.