Skip to content

Instantly share code, notes, and snippets.

View amiralles's full-sized avatar
🏠
Working from home

Ale Miralles amiralles

🏠
Working from home
View GitHub Profile
#!/bin/bash
set -e
# Get the list of changed files since the last commit
changed_files=$(git diff --name-only HEAD~1..HEAD)
if [ -z "$changed_files" ]; then
echo "No changes since the last commit."
exit 0
@amiralles
amiralles / change_view_font_size.py
Created September 8, 2023 15:36
Change View Font Size plugin for ST4
import sublime
import sublime_plugin
class ChangeViewFontSizeCommand(sublime_plugin.TextCommand):
def run(self, edit, by):
settings = self.view.settings()
settings.set("font_size", settings.get("font_size") + by)
// These shortcuts go easy on your wrists if you remap CAPS -> Ctrl.
[
{ "keys": [",", "/"],
"context": [
{ "key": "setting.command_mode", "operand": true },
{ "key": "setting.is_widget", "operand": false }
],
"command": "toggle_comment",
"args": { "block": false }
},
#!/bin/bash
# Converts camelCased words into snake_cased ones.
# (This might be seful when you have to convert a JS object into an Elixir one.)
# TODO: Ignore quoted strings.
function camel_to_snake_case {
while read -r line; do
echo $line | sed 's/\(.\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]'
done
}
@amiralles
amiralles / Default.sublime-theme
Last active October 18, 2024 12:13
Customizations for Sublime Text 4 default theme.
{
// http://www.sublimetext.com/docs/3/themes.html
"variables": {
"quick_panel_matched_label_color": "#ed2460",
},
"rules": [
{
"class": "text_line_control",
"parents": [{"class": "overlay_control"}],
"font.face": "Iosevka Fixed",
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>github.com&#x2f;jzelenkov</string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>gutterSettings</key>
<dict>
// These shortcuts go easy on your wrists if you remap CAPS -> Ctrl.
[
{ "keys": [",", "/"],
"context": [
{ "key": "setting.command_mode", "operand": true },
{ "key": "setting.is_widget", "operand": false }
],
"command": "toggle_comment",
"args": { "block": false }
},
#!/bin/bash
# This is a wraper around the standard find command that excludes directories
# we typically want to ignore while working with source code.
# This function is handy when we are trying to fuzzy find files using tools like
# *selecta*
find * -type f \
-not -path "_build/**" \
-not -path "bin/**" \
-not -path "deps/**" \
-not -path "doc/**" \
@amiralles
amiralles / .vimrc
Last active February 16, 2022 17:28
execute pathogen#infect()
syntax on
syntax enable
filetype plugin indent on
colorscheme monokai_pro
set cursorline
highlight CursorLine ctermbg=333333
@amiralles
amiralles / gitmine
Last active October 7, 2022 19:47
Shell script to mine your git repos.Copy this into your bin directory and run gitmine without arguments to see a list of available commands.
#!/bin/bash
function frequently_changed_files {
git log --name-only --pretty=format: | sort | uniq -c | sort -nr
}
# Find classes names on a given file.
function find_classes {
filename=$1
# Possible matches: