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
@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": ["ctrl+j"],
"command": "move", "args": {"by": "lines", "forward": true}
},
{
"keys": ["ctrl+k"],
"command": "move", "args": {"by": "lines", "forward": 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
Created November 20, 2021 02:39
Customizations for Sublime Text 4 default theme.
{
// http://www.sublimetext.com/docs/3/themes.html
"variables": {
"quick_panel_path_label_color":"#222",
"quick_panel_matched_label_color": "#022FDF",
"quick_panel_matched_path_label_color":"#111",
"quick_panel_selected_path_label_color": "#222",
"quick_panel_selected_matched_label_color": "#022FDF",
<?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": "run_macro_file",
"args": {
"file": "Packages/User/comment-and-move-to-the-next-line.sublime-macro"}
#!/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:
{
// Vim stuff.
"vintage_start_in_command_mode": true,
"vintage_ctrl_keys": true,
"added_words": [],
"caret_style": "smooth",
"tab_size": 2,
"translate_tabs_to_spaces": true,
"use_tab_stops": true,