Skip to content

Instantly share code, notes, and snippets.

@choan
choan / ctrl_esc_to_caps_lock.json
Created December 4, 2021 17:53
Karabiner rules to activate/deactivate Caps Lock layer using Ctrl + ESC
{
"title": "Ctrl + ESC -> Caps Lock",
"rules": [
{
"description": "Ctrl + ESC -> Caps Lock",
"manipulators": [
{
"from" : {
"key_code" : "escape",
"modifiers" : {
@choan
choan / .zshrc
Created December 2, 2021 15:09
Make zsh tab completion case insensitive
# to make tab completion case insensitive
# put this into your ~/.zshrc
# https://superuser.com/questions/1092033/
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
autoload -Uz compinit && compinit
@choan
choan / .myemacs.el
Last active November 3, 2021 09:22
Mi ficherito ~/.myemacs (in progress)
;; show current line number
(setq line-number-mode t)
;; show current column number
(setq column-number-mode t)
;; enable auto pairing of parens, bracketts, etc
(add-hook 'prog-mode-hook #'electric-pair-mode)
;; enable line numbering
@choan
choan / toc.html.erb
Created January 22, 2011 01:31
Recursive layout for generating nanoc menus
<% raise ArgumentError, "The @collection has no items to build the ToC." if @collection.empty? %>
<% @depth ||= -1 %>
<% @depth -= 1 if @depth > 0 %>
<% @reject ||= lambda { |x| false } %>
<% @sort_by ||= lambda { |x| x[:weight] || 0 } %>
<% @label ||= lambda { |x| x[:title] } %>
<% collection = @collection.reject(&@reject) %>
<% unless collection.empty? %>
<ul>
<% collection.sort_by(&@sort_by).each do |child| %>
├─┼─┼─┤
R * │ │
├─┼─┼─┤
│ │ * *
├─┼─┼─┤
│ * │ │
├─┼─┼─┤
* │ R *
├─┼─┼─┤
var EasternEggTrigger = function(sequence, callback) {
var seqString = sequence.join(' '),
seqLength = sequence.length,
got = [],
d = document,
handler = function(e) {
e = e || window.event;
got.push(e.keyCode);
if (got.join(' ').indexOf(seqString) !== -1) {
@choan
choan / snippet.rb
Created April 2, 2009 12:41
A method to define rake file tasks which depend on multiple files which are concatenated after being processed with ERB
module RakeExtensions
def concat(*args, &block)
t = Rake::FileTask.define_task(*args)
out_file = t.name
list = []
yield list if block_given?
t.enhance(list) do
File.open(out_file, 'w+') do |f|
f << list.map do |item|
ERB.new(IO.read(File.expand_path(item)), nil, '%').result(binding)
#!/bin/bash
locales="es en it ja fr de pt"
until [[ "$1" = "" ]]
do
base=${1%.*}
ext=${1#*.}
for lang in $locales
do cp $1 "${base}_${lang}.${ext}"
done
shift
// jShoulda 1.2.x
describe("Un ukelele", {
setup: function() {
// setup routines
},
teardown : function() {
// teardown routines
}
},
it("mola mucho", function() {