Skip to content

Instantly share code, notes, and snippets.

Avatar

Pablo Barrios sauron

View GitHub Profile
View VS Code Key Shortcuts.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+y",
"command": "default:redo"
},
/**
* Activity Bar
**/
{
@sauron
sauron / VS Code Settings.json
Created Aug 28, 2020
VS Code Settings. Dark Mode. Big Fonts. No panels. Focus Mode.
View VS Code Settings.json
{
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"editor.renderWhitespace": "all",
"editor.scrollBeyondLastLine": false,
"files.insertFinalNewline": true,
"editor.find.seedSearchStringFromSelection": true,
"editor.fontSize": 14,
"editor.tabSize": 4,
View Sublime USER Settings.json
{
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Palenight.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
@sauron
sauron / auto.sh
Last active Oct 7, 2016
My updated version of https://github.com/postmodern/chruby so it always set the gem_home as the directory where there is a .ruby-version file. Line 14 contains the "super hack"
View auto.sh
unset RUBY_AUTO_VERSION
function chruby_auto() {
local dir="$PWD/" version
until [[ -z "$dir" ]]; do
dir="${dir%/*}"
if { read -r version <"$dir/.ruby-version"; } 2>/dev/null || [[ -n "$version" ]]; then
if [[ "$version" == "$RUBY_AUTO_VERSION" ]]; then return
@sauron
sauron / sphinx.rb
Last active Aug 29, 2015
How to install sphinx 2.0.6 with Homebrew
View sphinx.rb
require 'formula'
class Libstemmer < Formula
# upstream is constantly changing the tarball,
# so doing checksum verification here would require
# constant, rapid updates to this formula.
head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
homepage 'http://snowball.tartarus.org/'
end
@sauron
sauron / median.rb
Created Jun 22, 2015
Median calculation for a given Array in Ruby
View median.rb
def median(array)
sorted = array.sort
len = sorted.length
return (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0
end
View keybase.md

Keybase proof

I hereby claim:

  • I am sauron on github.
  • I am pablo_barrios (https://keybase.io/pablo_barrios) on keybase.
  • I have a public key whose fingerprint is 02A9 9521 52E9 3BC3 8CC8 5995 E577 87B8 4A3C C3CC

To claim this, I am signing this object:

@sauron
sauron / http_runner.txt
Last active Aug 29, 2015
Easiest way to serve a static folder with ruby. Just change your working directory to the one of your app and run it with ruby.
View http_runner.txt
cd /path/to/my/static/page
ruby -run -ehttpd . -p8000
@sauron
sauron / hasher.rb
Created Mar 25, 2014
Basic hash creation methods for a given dictionary.
View hasher.rb
#Hash function which converts hash_me("leep", dictionary) => 13427273
def hash_me(text, dictionary)
h = 7
dictionary = "acdegilmnoprstuw"
text.size.times do |i|
h = (h * 37) + dictionary.index(text[i]).to_i
end
h
View Preferences.sublime-settings
{
"color_scheme": "Packages/Theme - Spacegray/base16-eighties.dark.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
You can’t perform that action at this time.