Skip to content

Instantly share code, notes, and snippets.

View oceansize's full-sized avatar

Roi oceansize

View GitHub Profile
@oceansize
oceansize / add-p.md
Created November 24, 2023 12:14 — forked from mattlewissf/add-p.md
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@oceansize
oceansize / osx_bootstrap.sh
Created April 26, 2020 10:31 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@oceansize
oceansize / Eyeballing-This.md
Created March 19, 2019 13:38 — forked from zcaceres/Eyeballing-This.md
Understanding Binding and 'this' in Javascript

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

To understand this, we need to see where it is invoked. Nothing else matters, with one exception which we'll cover in a moment.

Rails Is A Ghetto

I’ve more or less kept my mouth shut about some of the dumb and plain evil stuff that goes on in the Rails community. As things would happen though I’d take notes, collect logs, and started writing this little essay. As soon as I was stable and didn’t need Ruby on Rails to survive I told myself I’d revamp my blog and expose these fucks.

NOTE: This post is currently an open draft. Feel free to comment but it will have spelling and grammar errors and some paragraphs might not make sense. Check my blog and my atom feed to find out when I post the updates.

This is that rant. It is part of my grand exit strategy from the Ruby and Rails community. I don’t want to be a “Ruby guy” anymore, and will probably start getting into more Python, Factor, and Lua in the coming months. I’ve got about three or four more projects in the works that will use all of those and not much Ruby planned.

This rant is full of stories about companies and people who’ve either pissed in my cheerios somehow or screwed ov

Lifts/Funiculars I like:

Elevador da Gloria (Funicular)
Elevador de Santa Justa (Lift)

Nice view, over some beers:

Miradouro de Santa Luzia
Miradouro da Graça
Miradouro do Adamastor
class Base
def call
p "Base"
end
end
module Mixin
def call
p "Mixin"
super
def find_ascii_of(val)
@numero = [] # => []
val.each_byte do |x| # => "Hello!"
@numero << x # => [72], [72, 101], [72, 101, 108], [72, 101, 108, 108], [72, 101, 108, 108, 111], [72, 101, 108, 108, 111, 33]
end # => "Hello!"
return @numero # => [72, 101, 108, 108, 111, 33]
end
def convert
@numero.map! do |x| # => [72, 101, 108, 108, 111, 33]
def find_ascii_of(val)
@numero = [] # => []
val.each_byte do |x| # => "hello"
@numero << x # => [104], [104, 101], [104, 101, 108], [104, 101, 108, 108], [104, 101, 108, 108, 111]
end # => "hello"
return @numero # => [104, 101, 108, 108, 111]
end
def convert
@numero.map! do |x| # => [104, 101, 108, 108, 111]
def find_ascii_of(val)
@numero = []
val.each_byte do |x|
@numero << x
end
return @numero
end
def convert
@numero.map! do |x|
@oceansize
oceansize / gist:3612a923fc747c6f91f0
Created June 28, 2014 18:23
Speak or forever hold your peace...
def say_fizz
(1..100).map { |number| `say "#{fizzbuzz(number)}"` }
end