Skip to content

Instantly share code, notes, and snippets.

View damianesteban's full-sized avatar
🎯
Focusing

Damian Esteban damianesteban

🎯
Focusing
View GitHub Profile
@soldni
soldni / notion.js
Last active August 1, 2024 14:18
A Scriptable widget to display ToDos from a Notion database in a iOS widget.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: light-gray; icon-glyph: copy;
// follow instructions here https://developers.notion.com/docs/create-a-notion-integration
// for how to configure an integration, get the bearer token, and authorize the integration
// to access a Notion database.
const NOTION_DB_LINK = "https://www.notion.so/[YOUR USERNAME]/[LINK TO DATABASE]"
const BEARER_TOKEN = "Bearer secret_*******************************************"
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@aqwert
aqwert / ReadMe.md
Last active November 9, 2019 18:22
GraphQL Schema stiching

NOTE:

Although this is a gist with accompanied files, I will at some stage make a proper project with working parts.

Getting Started with a Graphql Microservice

This is an opinionated view of how to use Prisma Graphql backend in a microservice way. The idea is that each Graphql Micorservice has both a App GraphQL service (the one that creates a public API) and a Prisma GraphQL service (The one that is a ORM to a DB expiosing GraphQL CRUD, filtering and ordering operations). Each of these microservices are then "stitched" together to form a single GraphQL App Service (Like a Backend For Frontend service BFF) that the client consumes.

Creating a GraphQL Microservice

Registration Flow - iOS

A crucial type in the app is the CognitoStore. There's only ever one instance of this type that lives throughout the life-cycle of the app. Everywhere in our app, a dev has access to this one instance through the sharedInstance static stored property on the CognitoStore.

Important to note is the init function on this type. It sets everything up, most imporantly the userPool stored property of type AWSCognitoIdentityUserPool. This in turn will provide access to the AWSCognitoIdentityUser that exists on the AWSCognitoIdentityUserPool. This is done by calling currentUser() on the AWSCognitoIdentityUserPool instance.

We expose the AWSCognitoIdentityUser in the form of a computed property named currentUser.

Here's how accessing this currentUser looks like throughout the app:

@vagarenko
vagarenko / maybe.ts
Last active November 6, 2022 06:50
Maybe type in Typescript.
/**
* The Maybe type encapsulates an optional value.
*/
export class Maybe<T> {
/** Create an empty value. */
static nothing<T>(): Maybe<T> {
return new Maybe<T>(undefined);
}
/** Create a non-empty value. */
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#
@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active November 21, 2024 04:09
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@alexellis
alexellis / k8s-pi.md
Last active December 13, 2024 23:24
K8s on Raspbian
@Herakleis
Herakleis / ViewModel+RealLifeExample.swift
Last active April 27, 2019 19:59
ViewModel+RealLifeExample
import RxSwift
import Action
enum SceneStateOutput {
case idle
case sendingNoRecipient
case sendingSomeRecipients(sendingList: [String: String])
case sending
}
makeBitString :: Int -> [String]
makeBitString 0 = []
makeBitString 1 = ["0","1"]
makeBitString w = map ('0':) (makeBitString (w-1)) ++ map ('1':) (makeBitString (w-1))
makeMaskZeroString :: Int -> [String]
makeMaskZeroString w = ((map oneToMask) . makeBitString) w
where
oneToMask :: String -> String
oneToMask = (map (\c -> if c == '1' then '*' else c))