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 / 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
@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 April 28, 2024 11:17
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
@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");