Skip to content

Instantly share code, notes, and snippets.

View JorgeVV's full-sized avatar

Jorge Villalobos JorgeVV

View GitHub Profile
@srfrog
srfrog / cuid.sql
Created November 27, 2019 03:49
CUIDs for PL/PgSQL
-- Collision-resistant ids optimized for horizontal scaling and performance, for PL/PgSQL.
-- Based on https://github.com/ericelliott/cuid
-- Version 1.0.0
-- Usage: SELECT cuid();
-- BEGIN CONFIG ---
-- Put a unique host ID (int) here per server instance.
-- Once set, this value should not be changed.

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
@haf
haf / A vision for F#.md
Last active March 27, 2018 00:46
A vision for F#

What should F# as a language contain?

  • A default test framework like Expecto
  • A default HTTP client like HTTP.fs
  • A default web framework like Suave
  • A default JS framework like Fable
  • A default logging framework like Logary
  • A default character parser combinator library like FParsec
  • A default binary parser combinator library like FsAttoparsec
  • A default concurrent programming framework like Hopac
@disintegrator
disintegrator / main.ts
Last active November 14, 2020 06:58
RxJS + Axios
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import { Observable } from 'rxjs';
const fromRequest = (request: AxiosRequestConfig) =>
new Observable<AxiosResponse>(
(o) => {
const source = axios.CancelToken.source();
o.add(() => source.cancel('Operation canceled by the user.'));
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@brendanzab
brendanzab / reactive_systems_bibliography.md
Last active October 10, 2022 06:36
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle

Functional, Reactive, and Distributed Systems Bibliography

Books