Skip to content

Instantly share code, notes, and snippets.

Lance Jordan lacostenycoder

Block or report user

Report or block lacostenycoder

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lacostenycoder / clean_branches.rb
Created Aug 20, 2019
Clean branches by closed issue numbers
View clean_branches.rb
#!/usr/bin/env ruby
require 'octokit'
Dir.chdir(ENV['HOME'] + '/dev/clients/thoroughcare') # you will need to change this to where your repo is
client = netrc: true, auto_paginate: true
issues = client.issues 'thoroughcare/thoroughcare'
issue_numbers =
branches = `git branch --sort=committerdate`.split("\n").map(&:strip)
branch_issue_numbers ={|b| b[/\/\d+/]}.map{|i| i[/\d+/].to_i}
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 Nov 3, 2018 — forked from ZAYDEK/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
lacostenycoder / toggle-tap-click
Created Apr 15, 2018
Apple Script to toggle the tap to click setting for "typing" mode
View toggle-tap-click
tell application "System Preferences"
reveal anchor "trackpadTab" of pane ""
end tell
tell application "System Events" to tell process "System Preferences"
click checkbox 3 of tab group 1 of window 1
end tell
quit application "System Preferences"
lacostenycoder /
Last active Jul 16, 2019
Ruby script to toggle night-mode hack on Slack Desktop app - Mac only, maybe linux


For security, since this script injects CSS via AJAX, first fork the main slack night mode repo. The reason is explained here

UPDATE: The code has been modified to download the remote css to a local file and use ruby sass compiler to verify there is no malicious code in the remote css. This will error if the code has been modified to include anything malicious (i.e. script or img tags etc.) It's also been refactored to use the local file inside the js injection, it makes sure it's safe first in the very unlikely event the local file somehow differs from the remote css. The chances of this happening are remote, but this should suffice for safety.


  • save this script wherever you keep your ruby scripts for example ~/lacostenycoder/scripts/ruby/
  • change the URL in the remote_repo variable in ruby script to use YOUR repo. The file is crea
You can’t perform that action at this time.