Skip to content

Instantly share code, notes, and snippets.

@mkhmylife
mkhmylife / NotFound.tsx
Created May 29, 2023 08:44
NotFound.tsx
import { StyleSheet, TouchableOpacity } from 'react-native';
import { Text, View } from '../components/Themed';
import { RootStackScreenProps } from '../types';
import WebView from "react-native-webview";
export default function NotFoundScreen({ navigation, route }: RootStackScreenProps<'NotFound'>) {
if (route.path) {
return (
@mkhmylife
mkhmylife / NewsFeedScreen.tsx
Created May 29, 2023 08:36
NewsFeedScreen.tsx
import {ActivityIndicator, Linking, Platform, ScrollView, Share, StyleSheet, TouchableOpacity} from 'react-native';
import WebView, {WebViewNavigation} from "react-native-webview";
import { View, Text } from '../components/Themed';
import Layout from "../constants/Layout";
import Colors from "../constants/Colors";
import React, {useEffect, useMemo, useRef, useState} from "react";
import {NativeStackScreenProps} from "@react-navigation/native-stack";
import {RootStackParamList} from "../types";
import {BlogArticle, getBlogArticle} from "../services/news";
import airtable from 'airtable';
import { AirtableConfig } from '../airtableConfig';
import CacheService from './CacheService';
export default class AirtableService {
private config: AirtableConfig;
private table: Airtable.Table<any>;
private cache: CacheService;
export interface AirtableConfig {
route: string;
base: string;
table: string;
view?: string;
filter?: string;
fields: string[];
fieldMappings?: Function;
}
const CACHE_TTL = 1000 * 60; // 1 minute
export default class CacheService {
private memoryCache: string | undefined;
private cacheExpiredAt: number = Date.now();
public get(): any {
if (!this.memoryCache) {
throw new Error("Memory cache is empty");
@mkhmylife
mkhmylife / Dockerfile
Last active July 8, 2019 16:18
Laravel Mult-Arch Dockerfile
ARG PHP_EXTENSIONS="apcu bcmath opcache pcntl pdo_mysql redis zip sockets imagick gd exif"
FROM hyperair/php:7.3-v2-slim-apache
ENV TEMPLATE_PHP_INI=production \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false \
APP_ENV=prod \
APACHE_DOCUMENT_ROOT=/public
# For some reasons I can't get optipng pngquant to compile on Arm64
# USER root
# RUN rm -rf /var/lib/apt/lists/* && \
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeTags",
"ec2:DescribeInstances",
variables:
DOCKER_DRIVER: "overlay2"
REPOSITORY_URL: "changeme:latest"
stages:
- build
- deploy
services:
- docker:dind
@mkhmylife
mkhmylife / laravel-k8s-configmap.yaml
Created May 3, 2019 18:31
Laravel Kubernetes Deployment files
apiVersion: v1
kind: ConfigMap
metadata:
name: backend-config
data:
APP_DEBUG: "false"
APP_ENV: production
APP_KEY: changeme
APP_LOG_LEVEL: debug
APP_NAME: "Laravel K8s"