👀📎 It looks like you're preparing to MC a conference...
🚨 GIANT DISCLAIMER: This stuff is far from authoritative. But it's what I think works for me, and what I enjoy in an MC when I'm attending a conference.
/** | |
* React-Native cross-platform elevations. | |
* Based on https://ethercreative.github.io/react-native-shadow-generator/ | |
* | |
* Usage: | |
* 1. Import "elevations" from this file | |
* import { elevations } from "config/elevations"; | |
* 2. Use it. Assuming you need an elevation of 2 (based on the Android | |
* elevation standard), doing the following will cast the same shadow | |
* on both platforms: |
import { useRef } from "react"; | |
import { Animated, Easing } from "react-native"; | |
export const useAnimation = function(initialValue: number = 0) { | |
const endValue = initialValue === 0 ? 1 : 0; | |
const animationValueRef = useRef<Animated.Value>(new Animated.Value(initialValue)); | |
const setup = (config: Partial<Animated.TimingAnimationConfig> = {}) => | |
Animated.timing(animationValueRef.current, { | |
toValue: endValue, |
import React, { useEffect, useRef } from "react"; | |
import { | |
Animated, | |
Dimensions, | |
Image, | |
StyleSheet, | |
Text, | |
TouchableOpacity, | |
} from "react-native"; | |
import Config from "react-native-config"; |
// @flow | |
import * as React from "react"; | |
function useSelect( | |
initialValue: string | number, | |
items: Array<{ label: string, value: string | number }>, | |
) { | |
const [value, setValue] = React.useState(initialValue); | |
function onChangeValue(value: string) { |
import { useEffect, useRef } from 'react'; | |
function getItem(storage, key) { | |
const value = storage.getItem(key); | |
if (!value) return null; | |
try { | |
return JSON.parse(value); | |
} catch (error) { |
#!/bin/bash | |
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted | |
SEARCH_PATH="./Git" # Update this to the path where your code is stored | |
TOTAL_BYTES_REMOVED=0 | |
Mb=1000000 | |
Kb=1000 | |
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune) |
const requireHTTPS = (req, res, next) => { | |
if(req.headers['x-forwarded-proto'] !== 'https' && process.env.NODE_ENV === 'production') { | |
var secureUrl = "https://" + req.headers['host'] + req.url | |
res.writeHead(301, { "Location": secureUrl }) | |
res.end() | |
} | |
next() | |
} | |
app.use(requireHTTPS) |
// Parallax header content | |
window.onscroll = function emParallax() { | |
if(window.pageYOffset>1) { | |
document.getElementById("parallax").style["-webkit-transform"] = "translateY("+(window.pageYOffset/3)+"px)"; | |
} else { | |
document.getElementById("parallax").style["-webkit-transform"] = "translateY(0px)"; | |
} | |
} |
// javascripts/components/foo.js | |
export default function() { | |
console.log('foo'); | |
} |