This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Jimp = require("jimp"); | |
var url = | |
"http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-2.jpg"; | |
const saveAndResize = (image, name, width, height, extension) => { | |
image | |
.clone() | |
.cover(width, height) | |
.quality(50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import config from 'config' | |
import { getAccessToken } from 'libs/storage' | |
import { ApolloClient } from 'apollo-client' | |
import { createHttpLink } from 'apollo-link-http' | |
import { setContext } from 'apollo-link-context' | |
import { InMemoryCache } from 'apollo-cache-inmemory' | |
import customFetch from './customFetch' | |
const httpLink = createHttpLink({ | |
uri: config.GRAPHQL_URL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this file is imported by the entry point before any React code runs | |
import { Query } from 'react-apollo' | |
/** | |
* partialRefetch should always be true, but it defaults to false for reasons | |
* that are totally unimaginable to me. this hacks it on for us. | |
* | |
* note: today, Query has no defaultProps but this Object.assign ensures it works either way | |
* and will explicitly override any current or future value for `partialRefetch`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
import path from 'path' | |
function findRecursive(startPath: string, filter: string): string[] { | |
if (!fs.existsSync(startPath)) { | |
return [] | |
} | |
const found = [] | |
const files = fs.readdirSync(startPath) | |
for (let i = 0; i < files.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pure JS | |
const input = document.querySelector('input') | |
if(input) { | |
input.addEventListener('blur', (event) => { | |
window.op('event', 'search', { | |
query: event.target.value | |
}) | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createContext } from 'react'; | |
import { useWindowDimensions, View } from 'react-native'; | |
import Animated, { | |
useAnimatedStyle, | |
useSharedValue, | |
withSpring, | |
} from 'react-native-reanimated'; | |
import { LinearGradient } from 'expo-linear-gradient'; | |
import { Stack } from 'expo-router'; | |
import { COLORS } from '@/constants'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLERK_SECRET_KEY= | |
CLERK_SIGNING_SECRET= | |
CLICKHOUSE_DB= | |
CLICKHOUSE_PASSWORD= | |
CLICKHOUSE_URL= | |
CLICKHOUSE_USER= | |
DATABASE_URL= | |
GEO_IP_HOST= | |
NEXT_PUBLIC_API_URL= | |
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/login |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chmod +x setup.sh | |
sudo ./setup.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getRedisCache } from './redis'; | |
export function cacheable<T extends (...args: any) => any>( | |
fn: T, | |
expireInSec: number | |
) { | |
const cachePrefix = `cachable:${fn.name}`; | |
function stringify(obj: unknown): string { | |
if (obj === null) return 'null'; | |
if (obj === undefined) return 'undefined'; |