Skip to content

Instantly share code, notes, and snippets.

View backpackerhh's full-sized avatar
🏠
Working from home

David Montesdeoca backpackerhh

🏠
Working from home
View GitHub Profile
class SomeService
def call
call_service_a
end
private
def service_a
# ... uses status objects
end
@mlanett
mlanett / rails http status codes
Last active May 23, 2024 11:36
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@main = ->
canvas = document.getElementsByTagName("canvas")[0]
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl")
compiler = new WebGLCompiler(gl, window.shaders)
program = compiler.createProgramWithShaders("main_vertex", "main_fragment")
gl.clearColor(1.0, 1.0, 1.0, 1.0)
gl.clear(gl.COLOR_BUFFER_BIT)
gl.useProgram(program)
@rtt
rtt / gist:5a2e0cfa638c938cca59
Created August 14, 2014 09:46
example python tinderbot
# encoding: utf8 1,1 Top# encoding: utf8
import argparse
from datetime import datetime
import json
from random import randint
import requests
import sys
from time import sleep
@joshuaclayton
joshuaclayton / README.md
Last active October 25, 2023 18:28
RSpec custom matchers for Segment.io tracking
@JunichiIto
JunichiIto / alias_matchers.md
Last active May 28, 2024 12:04
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@ronaldsuwandi
ronaldsuwandi / tmux.conf
Last active May 17, 2024 06:47
Personal tmux.conf (updated for 3.2)
###########
# general #
###########
# Replace C-b prefix with Alt+Space (so it won't clash with vim)
unbind C-b
set-option -g prefix M-Space
set-window-option -g mode-keys vi
# set-option -g default-shell /usr/local/bin/fish
@abtrout
abtrout / pass.md
Created July 8, 2014 14:51
Using password-store with git repository synching

Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store. For more information about GPG, consult the GNU Privacy Handbook.

Getting started

To get started, install pass and generate a keypair.

$ brew install pass
$ gpg --gen-key
$ gpg --list-keys
@staltz
staltz / introrx.md
Last active June 2, 2024 11:03
The introduction to Reactive Programming you've been missing
@dhh
dhh / test_induced_design_damage.rb
Last active June 22, 2023 06:18
This is an extraction from Jim Weirich's "Decoupling from Rails" talk, which explained how to apply the hexagonal design pattern to make every layer of your application easily unit testable (without touching the database etc). It only seeks to extract a single method, the EmployeesController#create method, to illustrate the design damage that's …
# Original Rails controller and action
class EmployeesController < ApplicationController
def create
@employee = Employee.new(employee_params)
if @employee.save
redirect_to @employee, notice: "Employee #{@employee.name} created"
else
render :new
end