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
@ardecvz
ardecvz / vcr_intro.rb
Last active May 14, 2024 08:22
A VCR trick to include preparation and cleanup phases for external services directly within the test files (the phases run ONLY when recording cassettes)
# frozen_string_literal: true
# A VCR trick to include preparation and cleanup phases for external services
# directly within the test files (the phases run ONLY when recording cassettes):
#
# RSpec.describe EvilMartiansAPI::Client, vcr: true do
# let(:client) { described_class.new }
#
# let(:developer_team_number) { 42 }
#
@ardecvz
ardecvz / 00_evil_martians_api_client.md
Last active April 18, 2024 20:35
A ready-to-use example that features an opinionated Faraday configuration, optionally serving as a starting point for your own HTTP client
├── bin
│   └── console
├── config
│   └── evil_martians_api.yml
├── lib
│   ├── evil_martians_api
│   │   ├── api
│   │   │   └── developers.rb
│ │ ├── client
@thiagoa
thiagoa / linux-usb-file-copy-fix.md
Created November 3, 2021 01:14 — forked from 2E0PGS/linux-usb-file-copy-fix.md
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

@jferris
jferris / configmap.yaml
Last active February 8, 2024 14:15
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 17, 2024 12:44
set -e, -u, -o, -x pipefail explanation
@joshRpowell
joshRpowell / ruby2.5.0-command
Last active January 11, 2020 07:33
rvm install ruby 2.5.0 on macOS 10.13.2
•100% [I] ➜ rvm get master && rvm list known
Downloading https://get.rvm.io
Downloading https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
Verifying /Users/jpowell/.rvm/archives/rvm-installer.asc
gpg: Signature made Sat Sep 9 15:49:18 2017 EDT
gpg: using RSA key E206C29FBF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <mpapis@gmail.com>" [unknown]
gpg: Note: This key has expired!
Primary key fingerprint: 409B 6B17 96C2 7546 2A17 0311 3804 BB82 D39D C0E3
Subkey fingerprint: 62C9 E5F4 DA30 0D94 AC36 166B E206 C29F BF04 FF17
@palkan
palkan / factory_doctor.rb
Created March 27, 2017 15:42
FactoryDoc: detect useless data generation in tests
module FactoryGirl
module Doctor
module FloatDuration
refine Float do
def duration
t = self
format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000)
end
end
end
require 'mechanize'
require 'pry'
L = 'https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fau' \
'thorize%2F&scope=user_birthday,user_photos,user_education_history,email,user_relatio' \
'nship_details,user_friends,user_work_history,user_likes&response_type=token%2Csigned' \
'_request&client_id=464891386855067'.freeze
USER_AGENT = 'Mozilla/5.0 (Linux; U; en-gb; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML' \
', like Gecko) Silk/3.16 Safari/535.19'.freeze
@javivelasco
javivelasco / reactive-2016.md
Last active January 10, 2023 19:45
Proposal for lightning talk at Reactive Conf 2016

Please star ⭐️ the gist to help! This is a proposal for a ⚡️ talk at Reactive Conference.

Styling Components in React Toolbox 2

I wrote react-toolbox and presented it almost a year ago in lighning talk at Reactive Conf 2015 in Bratislava. At first it was just a proof of concept of a component library styled with CSS Modules and SASS. Now the project has grown quite a bit, and during this year there has been tons of changes and lessons learned.

Theming and customization is one of the most difficult and interesting problems to solve. For the first version we needed a custom Webpack loader to generate themes and doing simple style overrides was very painful. Today I'm working on a new playground that will allow you try CSS Modules live, and to create React Toolbox themes on the f

@jgillman
jgillman / restore.sh
Last active March 8, 2024 17:51
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db