Skip to content

Instantly share code, notes, and snippets.

View niquepa's full-sized avatar

Carlos Castillo niquepa

  • New York
View GitHub Profile
@niquepa
niquepa / machine.js
Last active August 30, 2021 16:38
Generated by XState Viz: https://xstate.js.org/viz
const contractMachine = Machine({
id: 'contracts',
initial: 'created',
context: {},
states: {
created: {
on: {
SAVE: 'created',
SUBMIT: 'estimated',
@niquepa
niquepa / friendship.rb
Created March 9, 2021 14:56 — forked from jibiel/friendship.rb
DRY Mutual Friendships / Friends in Ruby on Rails
# app/models/friendship.rb
class Friendship < ApplicationRecord
belongs_to :user
belongs_to :friend, class_name: 'User'
end
@niquepa
niquepa / autonomous.txt
Created September 9, 2020 19:37 — forked from benjamincharity/autonomous.txt
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@niquepa
niquepa / Gemfile
Created June 25, 2020 13:52 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@niquepa
niquepa / setup-gh-cli-auth-2fa.md
Created April 14, 2020 13:16 — forked from ateucher/setup-gh-cli-auth-2fa.md
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
@niquepa
niquepa / helper.scss
Created March 10, 2020 19:17 — forked from alalfakawma/helper.scss
Bulma SCSS Table column width helper
/*
Author: Aseem Lalfakawma <alalfakawma.github.io>
This SCSS mixin will allow sizing of table columns in Bulma CSS Framework.
The Bulma framework does not support this yet, this small code snippet fixes this.
USAGE:
* Should be applied on TH element, it controls all the columns under it *
The class should be "is-#",
is-1 will give the first widthamount, is-2 will give the second.
Eg. The code below shows the widthAmounts as (1, 2.5, 3, 4 , 5, 6, 7)
@niquepa
niquepa / RGeo_with_Proj.md
Created November 8, 2019 16:32 — forked from peterwake/RGeo_with_Proj.md
Installation of RGeo with Proj support (also called Proj4)

Installation of RGeo with Proj support (also called Proj4)

This is a real pain as of writing (18 Oct 2019). I can't promise it'll work either :)

Reference

Let's start from the beginning...

If you've been hacking around already you should do:

@niquepa
niquepa / rails http status codes
Created June 20, 2018 17:09 — forked from mlanett/rails http status codes
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
@niquepa
niquepa / PostgreSQL-Upgrade.md
Created March 23, 2018 15:18 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)

After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."

Database files have to be updated before starting the server, here are the steps that had to be followed:

need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default

brew unlink postgresql brew install [email protected] brew unlink [email protected] brew link postgresql

@niquepa
niquepa / Palindrome.rb
Created March 13, 2018 16:39
check if a string is a palindrome
def check_palindrome(string)
string.downcase == string.downcase.reverse
end