Skip to content

Instantly share code, notes, and snippets.

View adg29's full-sized avatar
📱

Alan Garcia adg29

📱
View GitHub Profile
@Aryk
Aryk / react-native-reanimated-2-custom-switch.tsx
Last active July 13, 2024 02:53
A custom extensible switch built in reanimated v2
import React, {useEffect} from "react";
import {StyleProp, StyleSheet, TouchableOpacity, TouchableOpacityProps, ViewProps, ViewStyle} from "react-native";
import Animated, {
interpolate,
useAnimatedStyle,
useSharedValue,
withTiming,
Easing,
Extrapolate,
interpolateColor, AnimateProps,
const admin = require('firebase-admin');
// expects the environment variable GOOGLE_APPLICATION_CREDENTIALS
const serviceAccount = require(process.env.GOOGLE_APPLICATION_CREDENTIALS);
const credential = admin.credential.cert(serviceAccount);
const PROJECT_ID = '<FIREBASE_PROJECT_ID>';
const app = admin.initializeApp({
credential: credential
@justincy
justincy / README.md
Last active April 5, 2024 22:19
Configure Storybook to work with Next.js, TypeScript, and CSS Modules

In addition to the Storybook for React setup, you'll also need to install these packages:

npm i -D @babel/core babel-loader css-loader style-loader
import { useState, useEffect } from 'react';
// Usage
function App() {
// Call our hook for each key that we'd like to monitor
const happyPress = useKeyPress('h');
const sadPress = useKeyPress('s');
const robotPress = useKeyPress('r');
const foxPress = useKeyPress('f');
@austil
austil / amap-git-log.csv
Last active November 5, 2019 21:00
Commit count by tag & author per week in CSV
year week feat fix docs style refactor test chore Dev 1 Dev 2 Dev 3 Dev 4 Dev 5 Dev 6 Dev 7 Dev 8 Dev 9 Dev 10 Dev 11 Dev 12
2016 43 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0
2016 44 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 4 0 0 0
2016 45 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 3 0 0 0
2016 51 2 0 0 2 1 0 0 0 0 0 0 0 0 0 0 5 0 0 0
2016 52 5 1 0 0 1 0 0 0 0 0 0 0 0 0 0 7 0 0 0
2016 53 0 1 0 0 2 0 0 0 0 0 0 0 0 0 0 3 0 0 0
2017 1 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0
2017 2 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0
2017 3 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 4 0 0 0
@kitze
kitze / conditionalwrap.js
Created October 25, 2017 16:54
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@blehman
blehman / README.md
Created March 12, 2017 01:00
Voronoi of the 50 largest urban areas in the US (d3.v4)
# BREW with xcode
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
sudo xcodebuild
brew update
brew install caskroom/cask/brew-cask
# BROWSERS
brew cask install firefox google-chrome
# JAVA
@clarketm
clarketm / largestBinaryGap.js
Last active October 12, 2022 12:13
Largest Binary Gap (JavaScript)
function largestBinaryGap(num) {
var bin = Math.abs(num).toString(2),
finalMax = 0,
currentMax;
for (var i = 0; i < bin.length; i++) {
currentMax = 0;
while (bin[i] === "0") {
++currentMax && ++i;
}
@nbremer
nbremer / .block
Last active January 30, 2018 13:15
Animated gradient - Simple rectangle
height: 140