Skip to content

Instantly share code, notes, and snippets.

View ianmartorell's full-sized avatar
🏠
Working from home

Ian Martorell ianmartorell

🏠
Working from home
  • Barcelona, Spain
  • 08:28 (UTC +01:00)
View GitHub Profile
@ianmartorell
ianmartorell / inngest.ts
Last active January 22, 2024 20:46
inngest.send with retries
import { retryFunction } from '@lib/utils/retryFunction';
import { ClientOptions, EventSchemas, EventsFromOpts, Inngest } from 'inngest';
import { SendEventPayload } from 'inngest/helpers/types';
import { Events } from './events';
const inngestOptions = {
id: 'my-app',
schemas: new EventSchemas().fromRecord<Events>(),
} satisfies ClientOptions;
@ianmartorell
ianmartorell / .fetchmailrc
Created April 11, 2022 15:50
Forward all emails in mailbox with folders
# ~/.fetchmailrc
poll mail.privateemail.com
with proto IMAP
uidl
user "[email protected]"
there with pass "password"
mda "msmtp -a [email protected] -- [email protected]"
folders "INBOX", "INBOX/Folder 1", , "INBOX/Folder 2"
ssl
@ianmartorell
ianmartorell / ExtendedOrder.ts
Created January 29, 2022 11:40
Prisma extended type
const extendedOrderArgs = Prisma.validator<Prisma.OrderArgs>()({
include: {
orderStatus: true,
orderItems: {
include: {
orderItemStatus: true,
},
},
},
});
@ianmartorell
ianmartorell / m3u8.sh
Created August 17, 2021 21:08
Download .m3u8 streams
#!/bin/sh
ffmpeg -i "$URL" -protocol_whitelist "file,http,https,tcp,tls" -codec copy out.mp4
@ianmartorell
ianmartorell / SortableList.tsx
Last active October 13, 2024 12:00
React Native component to render a list that is sortable through long press and drag. Tested with React Native Web.
import React, {
ReactElement,
useRef,
useState,
useCallback,
createRef,
RefObject,
useEffect,
useMemo,
} from 'react';
@ianmartorell
ianmartorell / HoverState.ts
Last active August 25, 2021 16:32 — forked from necolas/Hoverable.js
Hover styles in React Native for Web
/* eslint-disable no-inner-declarations */
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
let isEnabled = false;
if (canUseDOM) {
/**
* Web browsers emulate mouse events (and hover states) after touch events.
* This code infers when the currently-in-use modality supports hover
* (including for multi-modality devices) and considers "hover" to be enabled
{
"compilerOptions": {
"target": "ES6",
"module": "ESNext",
"lib": [ "DOM", "ESNext" ],
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": true,
module.exports = {
defaultNamespace: 'common',
useKeysAsDefaultValue: true,
locales: ['en', 'es'],
output: 'src/i18n/locales/$LOCALE/$NAMESPACE.json',
input: 'src/**/*.{js,ts,tsx}',
sort: true,
lexers: {
js: ['JsxLexer'],
ts: ['JavascriptLexer'],
@ianmartorell
ianmartorell / settings.json
Last active May 19, 2020 23:19
VSCode Settings
{
"window.zoomLevel": -1,
"window.titleBarStyle": "custom",
"editor.fontFamily": "Cascadia Code",
"editor.fontSize": 15,
"editor.fontLigatures": true,
"editor.tabSize": 2,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.codeActionsOnSave": {
public class MySingleton {
private static MySingleton sInstance;
private final Context mContext;
private MySingleton(Context context) {
mContext = context.getApplicationContext();
}
public getInstance(Context context) {
synchronized (MySingleton.class) {