Skip to content

Instantly share code, notes, and snippets.

View sandrods's full-sized avatar

Sandro Duarte sandrods

View GitHub Profile
@sandrods
sandrods / 01_focus.md
Last active April 24, 2025 15:16
Focus: A Developer's Context Switcher

Focus: A Developer's Context Switcher

When working on large codebases, developers often need to switch between different features or areas of the application. The focus script helps manage this cognitive load by creating organized workspaces for different contexts.

The Problem

Working on features that span multiple directories (controllers, models, views, specs) requires constant navigation and context switching. This leads to keeping multiple editor windows open, maintaining mental lists of relevant files, and repeatedly searching through deep directory structures.

The Solution

@sandrods
sandrods / input.scss
Created June 25, 2021 15:37
Generated by SassMeister.com.
@each $h in (80, 85, 90, 95, 110, 120) {
.fs-#{$h} { font-size: $h * 1% }
}
@sandrods
sandrods / input.scss
Created June 25, 2021 15:06
Generated by SassMeister.com.
@each $w in (300, 400, 500, 600, 700, 800) {
.fw-#{$w} { font-weight: #{$w} !important }
}
@each $h in (80, 85, 90, 95, 110, 120) {
.fs-#{$h} { font-size: #{$h}% !important }
}
@sandrods
sandrods / pg.sh
Last active June 22, 2020 16:58 — forked from kingbin/gist:9435292
Manually Start/Stop PostgresSQL on Mac
# Stop PostgreSQL from auto starting
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-12.plist
# Enable PostgreSQL to auto start
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-12.plist
# Start postgres
sudo -u postgres /Library/PostgreSQL/12/bin/pg_ctl start -D /Library/PostgreSQL/12/data
# Stop postgres
@sandrods
sandrods / odt-viewer.rb
Last active August 29, 2015 14:04
script to visualize the xml content of a .odt file
#!/usr/bin/env ruby
require 'launchy'
require "nokogiri"
require "zip"
xml = ""
Zip::File.open(ARGV[0]) do |zip|
content = zip.get_entry('content.xml').get_input_stream.read
@sandrods
sandrods / convocacoes.js
Created March 15, 2012 03:52
pseudo codigo de funcionamento da Tela de Montagem de Mesas
mesa = Mesa.new({
target: '#mesa',
onAssign: function(funcao_id, eleitor_id) {
Convocacao.create(funcao_id, eleitor_id)
},
onRemove: function(convocacao_id) {
Convocacao.remove(convocacao_id)
}
})
# coding: UTF-8
require 'ostruct'
def hash2col(hash, opts={})
ret = []
hash.each do |key, value|
value = yield(value) if block_given?
ret << OpenStruct.new(opts[:key] => key, opts[:value] => value)
end
@sandrods
sandrods / gist:1230272
Created September 20, 2011 20:44
unzip downloaded files
#!/usr/bin/env ruby
require 'fileutils'
f = FileUtils
file = ARGV[0]
dir = "tmp.#{Time.now}"
f.mkdir_p dir
@sandrods
sandrods / post_receive
Created September 14, 2011 21:15
git post_receive hook
#!/bin/sh
exit_with_error() {
echo "!!!! An error has occurred !!!!"
exit 1
}
# Initial directory is .git, so go to the working copy directory
cd ..
@sandrods
sandrods / .bash_profile
Created July 27, 2011 18:05
my Mac env
alias ll='ls -l'
alias 'cd..'='cd ..'
export DYLD_LIBRARY_PATH="/opt/oracle/instantclient_10_2"
export SQLPATH="/opt/oracle/instantclient_10_2"
export TNS_ADMIN="/opt/oracle/network/admin"
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export PATH=$PATH:$DYLD_LIBRARY_PATH
source ~/.git-completion.bash