Skip to content

Instantly share code, notes, and snippets.

let NETWORK_PRESETS = {
'GPRS': {
'offline': false,
'downloadThroughput': 50 * 1024 / 8,
'uploadThroughput': 20 * 1024 / 8,
'latency': 500
},
'Regular2G': {
'offline': false,
'downloadThroughput': 250 * 1024 / 8,
@badbabykosh
badbabykosh / trace.rb
Created July 10, 2021 18:44 — forked from bendilley/trace.rb
Get a trace from a 'stack too deep' error in Rails
$enable_tracing = false
#$trace_out = File.open(Rails.root + 'trace.txt', 'w')
set_trace_func proc { |event, file, line, id, binding, classname|
if $enable_tracing && event == 'call'
#$trace_out.puts "#{file}:#{line} #{classname}##{id}"
raise "crash me" if caller_locations.length > 500
end
}
@badbabykosh
badbabykosh / vpn.md
Created May 4, 2020 01:08 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@badbabykosh
badbabykosh / set-interval-spec.js
Last active September 4, 2015 00:16 — forked from pkananen/set-interval-spec.js
testing setInterval with Jasmine using a Mock Clock
describe('createIntervalCallback', function() {
var sut = $.clockTest;
it('calls setInterval with callback() at a delay of 7000 ms', function() {
spyOn(sut, 'callback');
jasmine.Clock.useMock();
sut.createIntervalCallback();
jasmine.Clock.tick(7000);