Skip to content

Instantly share code, notes, and snippets.

View thebiltheory's full-sized avatar
🎯
Focusing

Nabil thebiltheory

🎯
Focusing
View GitHub Profile
@thebiltheory
thebiltheory / ChoasLinesShader.metal
Created January 8, 2024 13:55 — forked from realvjy/ChoasLinesShader.metal
Choas Lines - Metal Shader
View ChoasLinesShader.metal
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
View useUserRequisite.ts
import {useState, useEffect} from 'react';
// Define a type for the prerequisite check function
type PrerequisiteCheck = () => Promise<any>;
export default function useUserPrerequisites(
prerequisiteChecks: PrerequisiteCheck[] = [],
) {
const [userHasPrerequisite, setUserHasPrerequisites] = useState(false);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
const checkPrerequisites = async () => {
View expo-app-background-image.tsx
import React, { useState, useEffect } from 'react';
import { View, Text, Image, AppState } from 'react-native';
const App = () => {
const [appState, setAppState] = useState(AppState.currentState);
const [isAppBackgrounded, setIsAppBackgrounded] = useState(false);
useEffect(() => {
const subscription = AppState.addEventListener("change", nextAppState => {
setAppState(nextAppState);
View AO.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thebiltheory
thebiltheory / timezones.json
Last active April 18, 2020 17:11 — forked from erdem/timezone_locations.py
Center location coordinates for timezones
View timezones.json
{
"Africa/Abidjan": [8, -5],
"Africa/Accra": [8, -2],
"Africa/Addis_Ababa": [8, 38],
"Africa/Algiers": [28, 3],
"Africa/Asmara": [15, 39],
"Africa/Bamako": [17, -4],
"Africa/Bangui": [7, 21],
"Africa/Banjul": [13.46666666, -16.56666666],
"Africa/Bissau": [12, -15],
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View fetchRetry.ts
function waitFor(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default async function fetchRetry(promise: Promise<unknown>, n: number, waitNseconds = 1000): Promise<unknown> {
try {
return await promise;
} catch (error) {
if (n === 1) throw error;
@thebiltheory
thebiltheory / useReduxPolling.ts
Created February 12, 2020 12:23
Dispatch a redux action every (n) seconds
View useReduxPolling.ts
import { useEffect, useRef } from 'react';
import { useDispatch } from 'react-redux';
function useReduxPolling(action: any, interval = 2000): void {
const dispatch = useDispatch();
const callback = useRef(action);
useEffect(() => {
callback.current = action;
View commitMessageConventions.md

FORMAT:

<type>[optional scope]: <description>

[optional body]

[optional footer]
@thebiltheory
thebiltheory / image_optimization.md
Created June 12, 2019 15:13
Image Optimization
View image_optimization.md

Optimize Images

  • Status: [proposed]
  • Deciders: [Hakim, Omar, Felix, Bil]
  • Date: [2019-06-13]

Technical Story: [description | ticket/issue URL]

Context and Problem Statement