Skip to content

Instantly share code, notes, and snippets.

View femicodes's full-sized avatar
🎧
Locked in

Oluwafemi femicodes

🎧
Locked in
  • localhost:5000
View GitHub Profile
@dmnkgrc
dmnkgrc / SplashScreen.js
Created March 22, 2021 17:11
The Splash Screen component
const Splashscreen = (props) => {
const [hasAnimationPlayedOnce, setHasAnimationPlayedOnce] = React.useState(false)
// We only want to hide the Splash Screen after it has played at least once
const handleAnimationFinish = () => {
setHasAnimationPlayedOnce(true)
}
const isModalVisible = !(props.isAppInitialized && hasAnimationPlayedOnce)
@yovany-lg
yovany-lg / expo-typescript-eslint-prettier.md
Last active June 23, 2025 07:19
Setting up React Navite: Expo + Typescript + Eslint (Airbnb) + Prettier

Steps to get started with Expo, Typescript, ESLint and Prettier

The first step is to use the Expo CLI to initialize the project. If you don't have the latest version of the Expo CLI tool, (or you don't have it installed) run npm install -g expo-cli.

Now run the following commands in the same order:

  • expo init my-app -t expo-template-blank-typescript
  • npx install-peerdeps --dev eslint-config-airbnb
  • npm i --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
  • npm i --save-dev prettier eslint-config-prettier eslint-plugin-prettier

Create or edit the file .eslintrc.json with the following content:

@jonasgroendahl
jonasgroendahl / PickerModal.tsx
Created August 10, 2020 13:38
Picker modal directly from the project
import React, {useState, useEffect} from 'react';
import {Modal, View, StyleSheet} from 'react-native';
import {Picker} from '@react-native-community/picker';
import Typography from './Typography';
import IconButton from './IconButton';
import Icon from './Icon';
import {useTranslation} from '../context/Language';
import ThemeColors from '../utils/Colors';
type Props = {
const widthPercentageToDP = widthPercent => {
const screenWidth = Dimensions.get('window').width;
const elemWidth = parseFloat(widthPercent);
return PixelRatio.roundToNearestPixel(screenWidth * elemWidth / 100);
};
const heightPercentageToDP = heightPercent => {
const screenHeight = Dimensions.get('window').height;
const elemHeight = parseFloat(heightPercent);
return PixelRatio.roundToNearestPixel(screenHeight * elemHeight / 100);
};
const sampleOptions = [
{ id: 'option-type', value: '3' },
{ id: 'option-type', value: '100336' },
{ id: 'option-type', value: '100354' },
{ id: 'option-type', value: '3' },
{ id: 'option-type', value: '109538' },
{ id: 'option-type', value: '3' },
{ id: 'option-type', value: '8303' },
{ id: 'option-type', value: '504' },
{ id: 'option-type', value: '503' },
@bradtraversy
bradtraversy / node_redis_cache.js
Created August 20, 2019 12:55
Node.js & Redis Caching
const express = require('express');
const fetch = require('node-fetch');
const redis = require('redis');
const PORT = process.env.PORT || 5000;
const REDIS_PORT = process.env.PORT || 6379;
const client = redis.createClient(REDIS_PORT);
const app = express();
@femicodes
femicodes / index.html
Created July 26, 2019 11:34
[Mixpanel] blog card
<div class="card">
<img src="https://d1zjcuqflbd5k.cloudfront.net/files/acc_2397/VHm7?response-content-disposition=inline;%20filename=Untitled-1.png&Expires=1478892577&Signature=OSZ74PqFR7qczD4Jwh0uMDSfVy-1Qt73G5YNDPTOLKISlJYqrEd1vE6hjbXzG3u8~yp3g2uqQMBJ6aIdVVL~Dxf29qHQ3CyuRkjYhKwir~7Oxg2uejfD3bkI05ZSoKl7UOLF8nuW29ipnZ80HSxfGE8WkCuFEvBYSy8z5NKsEyA_&Key-Pair-Id=APKAJTEIOJM3LSMN33SA">
<div class="cardContent">
<h1>The Future of Product Analytics</h1>
<p>Join a discussion with Forrester, A16z and Mixpanel on the future of Product Analytics.</p>
<p class="learnMore">Learn more</p>
</div>
</div>
@victorsteven
victorsteven / test.js
Last active August 1, 2019 18:47
test file
import chai from 'chai';
import chatHttp from 'chai-http';
import 'chai/register-should';
import app from '../index';
chai.use(chatHttp);
const { expect } = chai;
describe('Testing the book endpoints:', () => {
it('It should create a book', (done) => {
@bradtraversy
bradtraversy / docker_wordpress.md
Last active December 12, 2025 17:33
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@alexanmtz
alexanmtz / passport.js
Created January 13, 2019 20:42
Authentication with Node.js, Express, Sequelize, JWT and webtokens
const {
github
} = require('./secrets')
const passport = require('passport')
const gitHubStrategy = require('passport-github2').Strategy
const LocalStrategy = require('passport-local').Strategy
const passportJWT = require('passport-jwt')
const ExtractJWT = passportJWT.ExtractJwt
const JWTStrategy = passportJWT.Strategy
const jwt = require('jsonwebtoken')