Skip to content

Instantly share code, notes, and snippets.

TOKEN="paste slack token here"
bdate=$(date -d "$date -30 days" +"%Y%m%d")
slack-cleaner --token $TOKEN --message --channel dev --before $bdate --bot --perform --as_user --rate 0.2 --quiet
slack-cleaner --token $TOKEN --message --channel ci-builds --before $bdate --bot --perform --as_user --rate 0.2 --quiet
slack-cleaner --token $TOKEN --message --channel sentry --before $bdate --bot --perform --as_user --rate 0.2 --quiet
slack-cleaner --token $TOKEN --message --channel server_status --before $bdate --bot --perform --as_user --rate 0.2 --quiet
lacostenycoder / sum_redis_call_time_from_log.rb
Created Dec 20, 2019
Sum redis call_time from log file
View sum_redis_call_time_from_log.rb
#!/usr/bin/env ruby
# pass log filename as single argument
filename = ARGV[0]
lines = File.readlines(filename).select{|l| l =~ /call_time/}
puts filename
puts{|l| l[/\d+.\d+\b/].to_f}.reduce(&:+)
lacostenycoder / clean_branches.rb
Last active Mar 10, 2020
Clean branches by closed issue numbers
View clean_branches.rb
#!/usr/bin/env ruby
unless !!`which gh | grep 'bin/gh'`
abort('Please run brew install github/gh/gh first. exiting now.')
Dir.chdir(ENV['HOME'] + '/dev/clients/thoroughcare')
issue_numbers = `gh issue list -s open -L 500 | grep -o '^[[:digit:]]*'`.split("\n")
branches = `git branch --sort=committerdate`.split("\n").map(&:strip)
branch_issue_numbers ={|b| b[/\/\d+/]}.map{|i| i[/\d+/]}
delete_issue_numbers = branch_issue_numbers.reject{|n| issue_numbers.include? n}.map(&:to_s)
unless delete_issue_numbers.any?
lacostenycoder / snippets.cson
Created Aug 13, 2019
Add ruby benchmark snippet to atom editor
View snippets.cson
# ~/.atom/snippets.cson
prefix: "Benchmark"
body: " do |x|\n {\t$1}\n {\t$2}\nend"
lacostenycoder / find_use_env_vars.rb
Created Jul 29, 2019
Find used and unused environment variables in .env file
View find_use_env_vars.rb
#!/usr/bin/env ruby
#Run this in the root of your local github repo to find used env vars located in .env file
vars = File.readlines('.env')
keys ={|e| e[/^\w+/]}.compact.sort
used_keys ={|k| !`git grep #{k}`.empty? rescue nil}
puts used_keys
puts "\nThese env vars NOT used in codebase\n\n"
puts keys - used_keys
View injectJquery.js
function injectJquery(){
var script = document.createElement('script');
script.src = '';
script.type = 'text/javascript';
script.integrity = 'sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44'
//for more info or other versions see
View fix_webpacker_parser.rb
#!/usr/bin/env ruby
# goto the root of your application before running this script
filename = 'node_modules/vue-loader/lib/template-compiler/index.js'
text =
new_code = %q(code = prettier.format(code, { semi: false, parser: 'babel' }))
old_code = 'code = prettier.format(code, { semi: false })'
replace = text.gsub(old_code, new_code)
lacostenycoder / github-code-review.css
Created Mar 20, 2019
Github Code Review CSS hack
View github-code-review.css
.blob-code, .blob-code-inner {
font-weight: 300;
font-family: Hack Nerd Font; /* maybe */
font-family: Ubuntu Mono;
font-size: 14px;
-webkit-text-stroke-width: 0.4px;
-webkit-text-stroke-color: inherit;
.js-details-container:not(.commit-tease) {
lacostenycoder / checkout_branch
Last active Feb 21, 2019
Easily checkout local git branches with a ruby script
View checkout_branch
#!/usr/bin/env ruby
branches = `git branch --sort=committerdate | awk '{print $1}'`.split("\n").reject{|l| l == '*'}
branches.each_with_index{|b, i| puts "#{i < 10 ? ' ' : ''}""#{i} - #{b}" }
puts "\n"
print 'type branch number: '
target_num = gets.chomp
unless target_num.length == 0
lacostenycoder /
Last active Feb 14, 2021 — forked from zaydek-old/bookmark.min.js
A *simple* CSS debugger. To use, bookmark "Debug CSS" at Learn more here and (starts at 1:25)

In newer versions of chrome you may not be able to just drag the code to your quick shortcuts. As a workaround you can just do:

  1. Copy the raw javascript in bookmark.min.js to your clipboard.
  2. right-click on the the bookmarks bar and add select add page
  3. for the name type DebugCSS
  4. for page type javascript:/ then paste the js you copied in step 1
  5. click save.
  6. Do a happy dance, your done! Happy Dance