This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
def profile | |
old_strs = ObjectSpace.count_objects[:T_STRING] | |
old_objs = GC.stat[:total_allocated_objects] | |
yield.tap do | |
new_strs = ObjectSpace.count_objects[:T_STRING] | |
new_objs = GC.stat[:total_allocated_objects] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# frozen_string_literal: true | |
require 'byebug' | |
require 'json' | |
require 'csv' | |
module NewRelicInsides | |
class Parser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add ruby tracepoint | |
EXCLUDED_CLASSES = %w(Sidekiq::Worker Delayed::Worker Unicorn::Worker Sidekiq::Worker Parallel::DeadWorker | |
Parallel::Worker Concurrent::RubyThreadPoolExecutor::Worker Twilio::REST::TaskRouter::Worker) | |
$__TRACE_WORKERS = [] | |
trace = TracePoint.new(:class) do |tp| | |
class_name = tp.self.name | |
next if class_name.nil? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun findFibSeries(n: Int) { | |
val series = mutableListOf(0, 1) | |
(0..n).map { n -> | |
series.add(series.takeLast(2) | |
.reduce {sum, it -> sum + it}) | |
} | |
series.forEach { println(it) } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function *calcFib () { | |
let n = 0 | |
let fib = function(v) { | |
return v <= 1 ? v : fib(v - 1) + fib(v - 2) | |
} | |
while (true) yield fib(n++) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ssh -v -nNT -R 9999:localhost:3000 [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.shadow1 { | |
box-shadow: 0 0 20px 1px rgba(114,114,189,0.1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.UIControls.CountryField = React.createClass | |
mixins: [CountriesMixin] | |
getInitialState: -> {code: @props.data} | |
changeCountry: (evt) -> | |
code = evt.currentTarget.value | |
@setState(code: code) | |
@props.onChange(code) if @props.onChange? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Make sure you have 'colorize' gem installed already. | |
require 'colorize' | |
current_branch = `git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,'` | |
push_cmd = `ps -ocommand | grep "git push"` | |
if current_branch =~ /\/master/ && push_cmd =~ /(\-f|force|delete)/ | |
puts '*********************************************'.colorize(:red) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[xdebug] | |
zend_extension="/usr/local/opt/php55-xdebug/xdebug.so" | |
xdebug.default_enable=1 | |
xdebug.remote_enable=1 | |
xdebug.remote_port=9000 | |
xdebug.remote_handler="dbgp" | |
xdebug.remote_autostart=1 | |
xdebug.idekey="PHPSTORM" |