Skip to content

Instantly share code, notes, and snippets.

@hirbod
hirbod / LeanText.tsx
Last active November 14, 2024 06:31
React Native LeanView and LeanText component
import { type ComponentType, createElement, forwardRef } from 'react'
import type { TextProps } from 'react-native'
// uncomment for NativeWind support
//import { cssInterop } from 'nativewind'
const LeanText = forwardRef((props, ref) => {
return createElement('RCTText', { ...props, ref })
}) as ComponentType<TextProps>
@EvanBacon
EvanBacon / skeleton.tsx
Created October 23, 2024 23:38
Animated skeleton component with Expo SDK 52
"use client";
import React from "react";
import { View, StyleSheet, Animated, Easing, ViewStyle } from "react-native";
const BASE_COLORS = {
dark: { primary: "rgb(17, 17, 17)", secondary: "rgb(51, 51, 51)" },
light: {
primary: "rgb(250, 250, 250)",
secondary: "rgb(205, 205, 205)",

Vim Manipulation Cheat Sheet

Action

Key Result
v select
y copy (yank)
c change
d delete
@MarceloPrado
MarceloPrado / DestructiveActionGuard.tsx
Last active April 22, 2024 17:35
An easy way of seeking user confirmation before proceeding with a destructive action. Demo: https://twitter.com/marceloterreiro/status/1779657639745798411
import type { ReactElement } from "react";
import { cloneElement, memo, useCallback } from "react";
import { AlertV2 } from "@/components/AlertV2/alertV2Helpers";
export interface DestructiveActionGuardProps {
children: ReactElement<{ onPress: () => void }>;
confirmationTitle?: string;
confirmationDescription?: string;
}
@fzldn
fzldn / beautifier.js
Last active July 28, 2023 18:28
VS Code Laravel Blade formatter using extension Beautify 1.5.0 by HookyQR with js-beautify hacks
...
Beautifier.prototype.beautify = function() {
...
var source_text = this._source_text;
// BEGIN
source_text = source_text.replace(/\{\{(--)?((?:(?!(--)?\}\}).)+)(--)?\}\}/g, function(m, ds, c, dh, de) {
@brnpimentel
brnpimentel / beautify-html.js
Created December 18, 2017 13:37
JS Beautify hack to works with blade directives (laravel)
function style_html(html_source, options, js_beautify, css_beautify) {
html_source = html_source.replace(/\@([^\n\s]*)/ig, "<blade $1/>");
...
sweet_code = sweet_code.replace(/<blade ([^\n]*)\/>/ig, "@$1");
sweet_code = sweet_code.replace(/\(\ \'/ig, "('");
...
@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
@elevenetc
elevenetc / gist:bf795f94aaf3e92169ef
Last active July 31, 2024 02:03
Android SuppressWarnings list
//src: http://kurrytran.blogspot.ru/2014/05/android-studio-list-of-suppress-warning.html
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/adt-branding/src/META-INF/AndroidIdePlugin.xml
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/android/src/META-INF/plugin.xml
//Most Common Annotations
@SuppressWarnings("all")
@SuppressWarnings("unchecked")
@SuppressWarnings({"JavaDoc"})
@SuppressWarnings({"UnusedDeclaration"})