Skip to content

Instantly share code, notes, and snippets.

module Bla
HTTP_OK = 200
HTTP_BAD_REQUEST = 400
HTTP_UNAUTHORIZED = 401
HTTP_FORBIDDEN = 403
HTTP_NOT_FOUND = 404
HTTP_INTERNAL_SERVER_ERROR = 500
end
puts Bla::HTTP_OK
@ro31337
ro31337 / tweak_zsh.md
Created November 22, 2017 02:18
How to tweak zsh to include hostname
vim ./.oh-my-zsh/themes/robbyrussell.zsh-theme

Replace PROMPT with:

PROMPT='%{$fg_bold[white]%}%M ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
@ro31337
ro31337 / plan2.rb
Last active November 7, 2017 05:36
class Plan
def price
100
end
end
module SharedFunctions
private def load_or_save_origin
if origin.present?
# gid is the property (type string) defined in all decorators. This property will hold global id of the object.
class Plan
def price
100
end
end
class Promo
def initialize(origin, code)
@origin = origin
@code = code
@ro31337
ro31337 / awesome_pry.md
Last active March 11, 2021 21:54
Pry for Rails setup

How to make awesome pry for Rails

Tested on Rails 5.1, for development, test and production (!).

At the top of your Gemfile (don't add to :development or :test):

  • Add gem 'pry' to your Gemfile
  • Add gem 'awesome_print' to your Gemfile

Make sure you updated your application.rb (not development.rb):

class Car
attr_reader :num
attr_reader :seats
def initialize(num, seats)
@num = num
@seats = seats
end
end
@ro31337
ro31337 / docker_completion_for_zsh.md
Created August 13, 2017 02:12
Zsh docker completion

Docker Completion for Zsh (Official)

  • mkdir -p ~/.oh-my-zsh/plugins/docker/
  • curl -fLo ~/.oh-my-zsh/plugins/docker/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker
  • Add docker to plugins section in ~/.zshrc
  • exec zsh
@ro31337
ro31337 / settings.json_
Last active March 14, 2019 10:48
VSCode Solarized Dark Theme customization
/*
How to install in VSCode:
1. "Ctrl ," to open User Settings
2. Paste color customization (everything below comment, you may also want to keep the comment)
3. Save!
{
"window.zoomLevel": 1,
@ro31337
ro31337 / morse.ino
Created May 6, 2017 20:10
Arduino morse SOS code
int ledPin = 11;
void setup() {
pinMode(ledPin, OUTPUT);
}
void dash() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
# Right way to install Chocolatey - always specify version to avoid breaking changes!
$ChocoInstallPath = "$env:SystemDrive\ProgramData\Chocolatey\bin"
$env:chocolateyVersion = '0.9.10.3' # <-- HERE
if (!(Test-Path $ChocoInstallPath)) {
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
}