Skip to content

Instantly share code, notes, and snippets.

Avatar

Douglas Soares de Andrade douglas

View GitHub Profile
@douglas
douglas / weeks_count.rb
Created Jan 18, 2019 — forked from tlux/weeks_count.rb
Rails: Calculate the number of Calendar Weeks in a Year
View weeks_count.rb
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 Aug 21, 2018 — forked from tdd/GitHub with Operator Mono font for code.md
Use Operator Mono Ssm font in GitHub code views (PRs, diffs, etc.)
View GitHub with Operator Mono font for code.md

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 Feb 28, 2018
genesis_public_key
View genesis_public_key
04be271724b3df3dd641cbb13ae5b15b277bb87fb2de0f16050161ee5e43c3795b4161449b486028aa4db776556d0f30d2baf83dca7f13fb353ea745c268d13dd4;fnando
View gist:134f363b5c993b17ce7f13ccfcd98907
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 Oct 2, 2015 — forked from tevino/fix_virtualenv
Fix python virtualenv after python update
View fix_virtualenv
#!/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......"
View gist:5ce4625801e4c72ad1d3
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
View setup_pandas_notebook.sh
#!/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
View net.hecticjeff.firewall.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.hecticjeff.firewall</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
@douglas
douglas / default_python_project.sublime-project
Created Apr 24, 2013
SublimeJedi python example project file
View default_python_project.sublime-project
{
"folders":
[
{
"follow_symlinks": true,
"path": "/Users/douglas/Work/code/uniceub/final/sgpa_project"
}
],
"settings": {
"python_interpreter_path": "/Users/douglas/Work/ambientes/sgpa/bin/python",
@douglas
douglas / robot.js
Created Dec 1, 2012 — forked from heynemann/robot.js
Merry Go round
View robot.js
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot){
robot.clone();
robot.turn(45);
this.offset = 1;
};
Robot.prototype.onIdle = function(ev) {