Calculate the height of the keyboard when it is open.
An apollo useQuery
hook with built-in support for ScrollView's RefreshControl
using System.Collections; | |
using UnityEngine; | |
public class AIController : MonoBehaviour { | |
[SerializeField][Range(0f, 20f)] float sightRange = 5f; | |
[SerializeField][Range(0f, 1f)] float sightAngle = 0.3f; | |
GameObject player; | |
Vector3 headingToPlayer; | |
Vector3 sightHeading; |
using System.Collections.Generic; | |
using UnityEngine; | |
/** | |
* LAYER UTIL - ONE SCRIPT TO HOUSE EVERY LAYER MASK, ETC. | |
* | |
* USAGE: | |
* | |
* - Add all of your layers to the ULayerType enum | |
* - Update static getters to include all of your layers |
/** | |
* executePromisesInSequence | |
* | |
* Given an array of functions, each of which return a Promise, | |
* fire off each promise in sequence, one after the other. | |
* | |
* @param {func[]} promises | |
* @returns {Promise} | |
*/ |
#!/bin/bash | |
# ReactNative script to nuke all the things | |
# usage: | |
# - add each item below as a separate script in package.json | |
# - add one final script: | |
# - "nuke": "yarn clean-node-modules && yarn clean-pods && yarn clean-ios && yarn clean-android && yarn clean-rn-cache" | |
# - alternatively, copy this shell script and add the following cmd to package.json: | |
# - "nuke": "./react-native-nuke-sh" | |
# - you may need to run `sudo chmod 777 ./react-native-nuke-sh before this script can run` |
# stolen from: http://blog.joncairns.com/2013/01/reset-postgresql-auto-increment-value-in-rails/ | |
TABLES_TO_IGNORE = [] | |
ActiveRecord::Base.connection.tables.each do |table| | |
next if TABLES_TO_IGNORE.include?(table) | |
result = ActiveRecord::Base.connection.execute("SELECT id FROM #{table} ORDER BY id DESC LIMIT 1") | |
if result.any? | |
ai_val = result.first['id'].to_i + 1 | |
puts "Resetting auto increment ID for #{table} to #{ai_val}" | |
ActiveRecord::Base.connection.execute("ALTER SEQUENCE #{table}_id_seq RESTART WITH #{ai_val}") | |
end |
const badwords = [ | |
'frick', | |
'fark', | |
'dern', | |
'shiz' | |
].join('|'); | |
const badEmojis = [ | |
'\\u{1F4A9}', // pile of poo | |
'\\u{1F595}' // middle finger | |
].join('|'); |
# | |
# Simulates a shuffled deck of cards. | |
# This demonstrates *one* way to simulate drawing | |
# 5 cards at a time from a deck of cards. | |
# This logic could easily be applied to games such | |
# as Blackjack or Texas Hold'em. | |
# | |
# Note - I included a card.val method specifically for | |
# checking a card's value for comparison in Poker (e.g. | |
# a straight is 5 consecutive card vals of the same suite). |
const delay = (callback, time = 5000) => { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(); | |
}, time); | |
}) | |
.then(callback); | |
} | |
// USAGE |
import { Component } from 'react'; | |
/** | |
* Auto-bind all methods of a React class, excluding lifecycle methods | |
* | |
* USAGE: | |
* | |
* ``` | |
* class MyClass extends ComponentAutoBind { ... } | |
* ``` |