Skip to content

Instantly share code, notes, and snippets.

View vbylen's full-sized avatar
:bowtie:
thankful for health & family

vbylen

:bowtie:
thankful for health & family
View GitHub Profile
@bcoe
bcoe / npm-top.md
Last active June 16, 2024 08:40
npm-top.md

npm Users By Downloads (git.io/npm-top)


npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.

Metrics are calculated using top-npm-users.

# User Downloads
@lopspower
lopspower / README.md
Last active July 31, 2024 14:01
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 30, 2024 07:58
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
/**
* Converting seconds into proper time values like a digital clock
* 00:01:03
*/
let timmy = setInterval(showTime, 1000);
let seconds = 3595;
function showTime() {
//update the time as hours, minutes, and seconds 00:00:00
@wmcbain
wmcbain / useSize.tsx
Last active November 17, 2021 21:43
Small little hook to use in TypeScript React Native apps to get the size of a component onLayout
import { useCallback, useState } from 'react';
import { LayoutChangeEvent } from 'react-native';
export const useSize = (): [
{
height: number;
width: number;
},
(event: LayoutChangeEvent) => void
] => {
@mrousavy
mrousavy / react-native+0.63.0.patch
Last active January 29, 2022 04:14
react-native 0.63 patch for iOS 13 Modal's onRequestClose (Swipe down gesture)
diff --git a/node_modules/react-native/React/Views/RCTModalHostView.h b/node_modules/react-native/React/Views/RCTModalHostView.h
index 4e61886..2b8b6c0 100644
--- a/node_modules/react-native/React/Views/RCTModalHostView.h
+++ b/node_modules/react-native/React/Views/RCTModalHostView.h
@@ -17,7 +17,7 @@
@protocol RCTModalHostViewInteractor;
-@interface RCTModalHostView : UIView <RCTInvalidating>
+@interface RCTModalHostView : UIView <RCTInvalidating, UIAdaptivePresentationControllerDelegate>
@nandorojo
nandorojo / _app.tsx
Last active August 2, 2022 16:12
React Native Web + Next.js Scroll Restoration
// pages/_app.js
import ReactNativeNextJsScrollRestore from '../react-native-next-scroll-restore'
import { useEffect } from 'react'
function MyApp({ Component, pageProps }) {
useEffect(() => {
const unsubscribe = ReactNativeNextJsScrollRestore.initialize()
return () => {
@rickyansari
rickyansari / CountDownTimerHook.jsx
Last active December 6, 2022 20:42
Count Down Timer hook. which can be used in react-native and react application.
import React, {useEffect, useState} from 'react';
const ON = 'on';
const OFF = 'off';
const defaultTimerValue = 3;
const defaultTimerInterval= 1000;
const defaultTimeOutCallback = ()=>{alert('Time Over)};
function useCountDownTimer({
initialValue = defaultTimerValue,
interval = defaultTimerInterval,
@mrousavy
mrousavy / useStyle.ts
Last active August 1, 2023 13:16
`useStyle` - a typed `useMemo` for styles which also includes style flattening and searching
import { DependencyList, useMemo } from "react";
import {
ImageStyle,
RegisteredStyle,
StyleProp,
StyleSheet,
TextStyle,
ViewStyle,
} from "react-native";