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 / .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'
@lacostenycoder
lacostenycoder / current_chrome_theme.rb
Last active May 9, 2023 03:42
Find your current Google Chrome Theme on the Web store (Mac only)
#!/usr/bin/env ruby
username = `whoami`.strip
filename = "/Users/#{username}/Library/Application\ Support/Google/Chrome/Default/Preferences"
data = File.read filename
string = data.split("theme")[1]
sha = string.split(/\W/)[7]
chrome_store_url = "https://chrome.google.com/webstore/detail/#{sha}"
puts chrome_store_url
`open #{chrome_store_url}`
@lacostenycoder
lacostenycoder / README.md
Last active November 2, 2023 17:18
Ruby script to toggle night-mode hack on Slack Desktop app - Mac only, maybe linux

- IMPORTANT

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.

Installation

  • 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 rawgit.com file is crea
@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 / .functions
Last active March 29, 2021 22:05
helpful functions
# Show listing ports in MacOS from https://stackoverflow.com/a/30029855/3625433
listening_ports() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
@lacostenycoder
lacostenycoder / README.md
Last active February 14, 2021 14:59 — forked from zaydek-old/bookmark.min.js
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (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
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 / 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 / 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)
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/