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}
},
@amiralles
amiralles / graph.rb
Created November 29, 2018 18:50
Graph implementation using Ruby
require_relative "./linked_list.rb"
require_relative "./set.rb"
# Here we monkey patched LinkedList to add a method
# that allows us to remove vertices in constant time.
class LinkedList
# Removes the node that is right next
# to the specified node.
# Complexity O(1).
def remove_next prev_node
// 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"}
{
// 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,
class HashTable
class Slot
attr_accessor :key, :value, :vacated
def initialize key, value
self.key = key
self.value = value
self.vacated = true
end
@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:
@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
#!/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",