Skip to content

Instantly share code, notes, and snippets.

View tutts's full-sized avatar
👨‍💻

Sam Tutton tutts

👨‍💻
  • London
View GitHub Profile
@hirbod
hirbod / BarTest.tsx
Last active February 16, 2025 17:12
Reanimated CSS 4 Search Bar Header Replica (hacked together quick and dirty, no support!)
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { useCallback, useLayoutEffect, useMemo, useReducer, useRef, useState } from 'react'
import { ActivityIndicator, Keyboard, Platform, Text, View, TextInput, useWindowDimensions } from 'react-native'
import Animated from 'react-native-reanimated'
const SearchBar = () => {
const inset = useSafeAreaInsets()
const [isFocused, toggle] = useReducer((s) => !s, false)
const ref = useRef<View>(null)
const rect = useRef({ width: 0, height: 0, x: 0, y: 0 })
@lededje
lededje / testSetup.js
Created January 8, 2018 01:41
This is a gist that patches react-native's components and apis with jest to allow you to use Enzyme's react 16 adapter
import React from 'react';
jest.mock('react-native', () => {
const createMockComponent = (name) => {
const mockedComponent = ({ children }) => (
<div>{children}</div>
);
mockedComponent.displayName = name;
return mockedComponent;
}
@mfd
mfd / 06.png
Last active September 6, 2025 20:50
Gilroy font
06.png
@regilero
regilero / nginx.conf
Last active February 26, 2021 12:22 — forked from thoop/nginx.conf
Altered prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
# Generate $prerender_ua bool value based on user agent
# indexation bots will get this as 1,
# prerender user agent will always get 0 (avoid loops)
map $http_user_agent $prerender_ua {
default 0;
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active August 28, 2025 08:25
React Native Bridging Cheatsheet
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active July 5, 2025 14:15
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@thoop
thoop / nginx.conf
Last active May 27, 2025 07:08
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;