Skip to content

Instantly share code, notes, and snippets.

View viniciuSquare's full-sized avatar

Vinícius Quadrado viniciuSquare

View GitHub Profile
@rpggio
rpggio / parseOrNull.ts
Last active April 4, 2024 04:34
React hook to persist MUI DataGrid column settings
/**
* If argument is a string, try to parse as JSON.
* Otherwise return null.
*/
export function parseOrNull(raw: unknown) {
if (!raw) return null
if (typeof raw === 'string') {
try {
return JSON.parse(raw)
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@JoaquimLey
JoaquimLey / create_new_ssh_key.md
Last active April 4, 2024 11:07
Generating a new SSH key and adding it to the ssh-agent

Generating a new ssh-key

Open Terminal. Paste the text below, substituting in your GitHub email address.

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This creates a new ssh key, using the provided email as a label

Generating public/private rsa key pair.

@namyarxam
namyarxam / maxrayman_joins.md
Created May 10, 2016 17:15
My PSQL Join Guide from General Assembly

Summary

On the most basic level, the way we learned to query through a table in one of our databases is pretty simple.

The SQL SELECT statement allows us to search through a table and return a custom results table with whatever columns/groupings/operations we specified in our query.

SELECT * FROM movies WHERE rottentomatoes > 85 AND lead_actor like 'Kevin Spacey';

Unfortunately, sometimes the queries need an added level of complexity and a simple statement like the one above wont do the trick. Here are two scenarios where we need to add some intricacy to our SQL statement in order to perform a sufficient query:

  1. We want to query for consistencies between two separate tables that are connected through a reference key.
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites