Skip to content

Instantly share code, notes, and snippets.

badbabykosh / trace.rb
Created Jul 10, 2021 — forked from bendilley/trace.rb
Get a trace from a 'stack too deep' error in Rails
View trace.rb
$enable_tracing = false
#$trace_out = + '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
badbabykosh /
Created May 4, 2020 — forked from joepie91/
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 /
Last active Aug 25, 2017
Angular2 vs Angular4

What is the diff between Angular2 and Angular4?

Well there is no path breaking change that means Angular 4 is not a complete rewrite of Angular 2 .

Google has adapted SEMVER (Semantic versioning) approach for it’s Angular Framework.

  • Why not Angular 3?

Due to misalignment of router package version . As @angular/router was using v3.3 already , so they switch to Angular 4 Finally .

  • What has Changed?

Angular team has laid emphasis on making angular apps more faster,compact .

Under the Hood Changes

New changes reduce the size of the generated code for your components by around 60% in most cases.

The more complex your templates are, the higher the savings.


badbabykosh / set-interval-spec.js
Last active Sep 4, 2015 — forked from pkananen/set-interval-spec.js
testing setInterval with Jasmine using a Mock Clock
View set-interval-spec.js
describe('createIntervalCallback', function() {
var sut = $.clockTest;
it('calls setInterval with callback() at a delay of 7000 ms', function() {
spyOn(sut, 'callback');
badbabykosh / hash_of_hashes.rb
Created Dec 9, 2012
Attempting to build hash of hashes
View hash_of_hashes.rb
def build_virtual_boards_hash(board, player)
virtual_boards_hash = {}
new_board_hash = {}
virtual_board = board.dup
empty_spaces_on_board ={ |k, v| v == " " }.keys
index_mark = 'VB'+empty_spaces_on_board.length.to_s
while empty_spaces_on_board.length >= 1
empty_spaces_on_board.each do |empty_space_symbol|