Skip to content

Instantly share code, notes, and snippets.

View lacostenycoder's full-sized avatar
👓
Tooling not fooling

Lance Jordan lacostenycoder

👓
Tooling not fooling
View GitHub Profile
@lacostenycoder
lacostenycoder / index.html
Created January 14, 2017 09:06
Chrome Autofill Exploit Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Chrome Autofill Hack</title>
</head>
<style media="screen">
.hidden {
/*display: none;*/
}
@lacostenycoder
lacostenycoder / clean_branches.rb
Last active March 10, 2020 20:44
Clean branches by closed issue numbers
#!/usr/bin/env ruby
unless !!`which gh | grep 'bin/gh'`
abort('Please run brew install github/gh/gh first. exiting now.')
end
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 = branches.select{|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
lacostenycoder / sum_redis_call_time_from_log.rb
Created December 20, 2019 16:08
Sum redis call_time from log file
#!/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 lines.map{|l| l[/\d+.\d+\b/].to_f}.reduce(&:+)
function injectJquery(){
var script = document.createElement('script');
script.src = 'https://code.jquery.com/jquery-2.2.4.min.js';
script.type = 'text/javascript';
script.integrity = 'sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44'
script.crossOrigin="anonymous"
document.getElementsByTagName('head')[0].appendChild(script);
}
//for more info or other versions see https://code.jquery.com/
@lacostenycoder
lacostenycoder / snippets.cson
Created August 13, 2019 21:40
Add ruby benchmark snippet to atom editor
# ~/.atom/snippets.cson
".source.ruby":
"Initialize":
prefix: "Benchmark"
body: "Benchmark.bm do |x|\n x.report(:a) {\t$1}\n x.report(:b) {\t$2}\nend"
@lacostenycoder
lacostenycoder / fix_webpacker_parser.rb
Created April 29, 2019 20:16
Fix vue.js no parser error
#!/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 = File.read(filename)
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
lacostenycoder / github-code-review.css
Created March 20, 2019 18:55
Github Code Review CSS hack
.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
lacostenycoder / checkout_branch
Last active February 21, 2019 14:56
Easily checkout local git branches with a ruby script
#!/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
lacostenycoder / toggle-tap-click
Created April 15, 2018 13:56
Apple Script to toggle the tap to click setting for "typing" mode
tell application "System Preferences"
reveal anchor "trackpadTab" of pane "com.apple.preference.trackpad"
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
lacostenycoder / .gitconfig
Created August 5, 2017 14:44
sample of my git config with git ll and lg for single line git log with colorful output.
[user]
name = Your Name
email = youremail@example.com
[color]
ui = auto
[alias]
st = status -sb -uall
lg = log --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset' --graph
ll = log --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset'