Skip to content

Instantly share code, notes, and snippets.

View asanchezr's full-sized avatar

Alejandro Sanchez asanchezr

  • Victoria BC, Canada
View GitHub Profile
@asanchezr
asanchezr / keycloak_get_idp_token.md
Created February 9, 2022 00:22 — forked from luszczynski/keycloak_get_idp_token.md
Keycloak - Get IDP Token using Curl

Keycloak - Get IDP Token

Get Access Token

export TKN=$(curl -X POST 'http://127.0.0.1:8080/auth/realms/your-realm/protocol/openid-connect/token' \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "username=your-user" \
 -d 'password=your-pass' \
 -d 'grant_type=password' \
@asanchezr
asanchezr / 2019-https-localhost.md
Created October 13, 2021 18:07 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@asanchezr
asanchezr / bash.generate.random.alphanumeric.string.sh
Created September 28, 2021 21:14 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@asanchezr
asanchezr / push-to-someone-elses-pr.md
Created September 14, 2021 18:53 — forked from wtbarnes/push-to-someone-elses-pr.md
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called

@asanchezr
asanchezr / macOS-setup.sh
Created September 24, 2020 22:14
Set up a macOS device for development in one script.
#!/bin/bash
# Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
####################################
# Brew apps
####################################
brew install wget
brew install git
@asanchezr
asanchezr / gist:22e669326524fb2dcad7eb860b908a92
Created May 4, 2020 23:58 — forked from kylefox/gist:4512777
If you want to use Xcode's FileMerge as your git mergetool, this is how you set it up.
# Tell system when Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@asanchezr
asanchezr / _rem-calc.scss
Created September 30, 2019 18:36
rem-calc function
@function rem-calc($size) {
$remSize: $size / 16;
@return #{$remSize}rem;
}
function subjectsReducer(state = initialSubjectsState(), action = {}){
switch(action.type){
case LOAD_SUBJECTS_RESULTS:
return Object.assign({}, state, { list: subjectsToHash(action.subjects) });
case EDIT_SUBJECT:
var editingSubject = state.list[action._id],
newSubjectParent,
eligibleParents = flattenedSubjects(state.list).filter(s => s._id !== action._id && (!new RegExp(`,${action._id},`).test(s.path)));
if (editingSubject.path == null){