Skip to content

Instantly share code, notes, and snippets.

View douglas's full-sized avatar

Douglas Soares de Andrade douglas

View GitHub Profile
@douglas
douglas / keybase.md
Created November 6, 2024 21:30
Keybase Proof

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@douglas
douglas / keymap.json
Created June 21, 2024 16:35 — forked from joeldrapper/keymap.json
My Zed Config
[
{
"context": "Editor",
"bindings": {
"alt-up": "editor::SelectLargerSyntaxNode",
"alt-down": "editor::SelectSmallerSyntaxNode",
"ctrl-cmd-up": "editor::MoveLineUp",
"ctrl-cmd-down": "editor::MoveLineDown"
}
}
module Inertiable
extend ActiveSupport::Concern
included do
before_action :inertiable
end
def inertiable
response.set_header('Vary', 'Accept')
response.set_header('X-Inertia', true) if inertiable?
@douglas
douglas / weeks_count.rb
Created January 18, 2019 16:43 — forked from tlux/weeks_count.rb
Rails: Calculate the number of Calendar Weeks in a Year
def weeks_count(year)
last_day = Date.new(year).end_of_year
if last_day.cweek == 1
last_day.prev_week.cweek
else
last_day.cweek
end
end
@douglas
douglas / GitHub with Operator Mono font for code.md
Created August 21, 2018 13:14 — forked from tdd/GitHub with Operator Mono font for code.md
Use Operator Mono Ssm font in GitHub code views (PRs, diffs, etc.)

So you love the Operator Mono font? I don't blame you! So do we! It's a bit pricey but worth every penny.

In fact, we're so used to it in our editors that we were a bit sad with GitHub's otherwise neat code views. When we review PRs in the web UI, we want our Operator Mono!

So, assuming you have it installed on your machine, you can put the JS bit in the other code snippet of this Gist in a bookmarklet, and click it when you're on a GitHub.com page you want to have switch over to our beloved font. We used the ScreenSmart variant here, which you get in the font package and have probably installed, as it's the more legible one on screens. Feel free to adjust the font name if needed.

@douglas
douglas / genesis_public_key
Last active February 28, 2018 15:20
genesis_public_key
04be271724b3df3dd641cbb13ae5b15b277bb87fb2de0f16050161ee5e43c3795b4161449b486028aa4db776556d0f30d2baf83dca7f13fb353ea745c268d13dd4;fnando
@douglas
douglas / gist:134f363b5c993b17ce7f13ccfcd98907
Created September 23, 2016 13:38
Install Nokogiri using bundle
brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install
@douglas
douglas / fix_virtualenv
Created October 2, 2015 17:19 — forked from tevino/fix_virtualenv
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip2)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
echo "Ensure the root of current virtualenv:"
echo " $ENV_PATH"
read -p "‼️ Say no if you are not sure (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "♻️ Removing old symbolic links......"
@douglas
douglas / gist:5ce4625801e4c72ad1d3
Created June 18, 2015 19:37
PF rules sshuttle
table <exclude_subnets> {200.152.40.0/24,127.0.0.0/8,10.0.0.0/8}
table <allowed_subnets> {!200.152.40.0/24,!127.0.0.0/8,!10.0.0.0/8}
table <include_subnets> { 0.0.0.0/0}
rdr pass on lo0 proto tcp to <include_subnets> -> 127.0.0.1 port 12300
pass out route-to lo0 inet proto tcp to <include_subnets> keep state
pass out route-to lo0 inet proto tcp to <exclude_subnets> keep state
#!/bin/sh
setup_brew () {
if ![-f "/usr/local/bin/brew"]; then
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
}
setup_ipython () {
brew install readline