Skip to content

Instantly share code, notes, and snippets.

View migrap's full-sized avatar

Michael Park migrap

View GitHub Profile
@migrap
migrap / query_stream.ex
Created November 4, 2025 03:21 — forked from korczis/query_stream.ex
Query Stream - Transform your Ecto Query into Stream!
defmodule Ecto.QueryStream do
@moduledoc """
A module to create a stream from an Ecto query.
This module provides functionality to stream results from an Ecto query in a paginated manner.
It is useful for handling large datasets efficiently by loading records in batches.
## Example Usage
query = from u in User, where: u.age > 30

Visualize primary and replicas (inspired by Waterpark)

Mix.install([
  {:kino, "~> 0.16.1"}
], consolidate_protocols: false)

Library modules

@migrap
migrap / AccessToken.php
Created June 22, 2024 21:46 — forked from onamfc/AccessToken.php
Add Custom Claims to Passport 8 / Laravel 6
<?php
namespace App\Passport;
use App\User;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use League\OAuth2\Server\CryptKey;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
@migrap
migrap / match-ts.ts
Created July 20, 2023 19:02 — forked from waynevanson/match-ts.ts
A port of switch-case statements for fp-ts.
/**
* A port of switch-case statements for fp-ts.
*
* This could be broken down further and perhaps extended into a new type-class.
* It does the specific job I needed it to.
*
* If you have an abstraction that might help, i'd love to hear about it!
*/
import { array, either, option } from "fp-ts";
interface SystemAuthenticationDetails {
accountType: "system";
systemId: number;
}
interface UserAuthenticationDetails {
accountType: "user";
userId: string;
}
@migrap
migrap / deferred-promise.ts
Created January 5, 2021 21:34 — forked from GFoley83/deferred-promise.ts
Deferred Promise for Typescript
/**
* A new instance of deferred is constructed by calling `new DeferredPromse<T>()`.
* The purpose of the deferred object is to expose the associated Promise
* instance APIs that can be used for signaling the successful
* or unsuccessful completion, as well as the state of the task.
* @export
* @class DeferredPromise
* @implements {Promise<T>}
* @template T
* @example
@migrap
migrap / laravel-permission.md
Created December 8, 2020 22:04 — forked from muhozi/Laravel-permission.md
Setting proper permissions to laravel directory

Setting up proper permissions to a laravel directory

There are basically two ways to setup your ownership and permissions. Either you give yourself ownership or you make the webserver the owner of all files.

Webserver as owner (the way most people do it):

Assuming www-data is your webserver user.

@migrap
migrap / Gatsby-bootstrap-lifecycle.md
Created March 26, 2020 05:11 — forked from swyxio/Gatsby-bootstrap-lifecycle.md
Gatsby bootstrap lifecycle

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

  1. open and validate gatsby-config (get-config-file.js) 1.5 load themes (swyx added this note July 2019)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c9
services.AddHttpClient(name, client => {
    client.BaseAddress = new Uri("https://evo.hostedsuite.com/api");
    client.DefaultRequestHeaders.Add("Accept", "application/json");
});
public async Task<HttpResponseMessage> SendAsync(HttpMethod method, string uri, IReadOnlyDictionary<string, object> parameters = null) {
    var union = (new Dictionary<string, object>() {
 {"CustomerName", _options.Customer },

Keybase proof

I hereby claim:

  • I am migrap on github.
  • I am migrap (https://keybase.io/migrap) on keybase.
  • I have a public key whose fingerprint is 30B8 0D30 F0FF F585 3771 1CFD 187C 9D5B E100 6CBE

To claim this, I am signing this object: