Skip to content

Instantly share code, notes, and snippets.

View slonoed's full-sized avatar
🥔

Dmitry Manannikov slonoed

🥔
View GitHub Profile
@arabold
arabold / useDataStoreQuery.tsx
Last active February 23, 2023 18:07
Simplify querying the Amplify DataStore using React hooks
import {
DataStore,
PersistentModel,
PersistentModelConstructor,
ProducerModelPredicate,
SortPredicate,
ProducerPaginationInput
} from '@aws-amplify/datastore'
import { useCallback, useEffect, useState } from 'react'
@neogeek
neogeek / OculusSDKAutomation.cs
Last active September 14, 2022 07:47
Oculus SDK Unity Setup
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
public static class OculusSDKAutomation
{
private static readonly GameObject playerControllerPrefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Oculus/VR/Prefabs/OVRPlayerController.prefab");
private static readonly GameObject controllerPrefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Oculus/VR/Prefabs/OVRControllerPrefab.prefab");
@pirate
pirate / docker-compose-backup.sh
Last active March 31, 2024 00:51
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@JohannesDeml
JohannesDeml / EditPrefabInScene.cs
Last active May 17, 2023 04:40 — forked from ulrikdamm/EditPrefab.cs
Unity editor script for better editing of prefabs. Put in Assets/Editor.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
// From https://gist.github.com/JohannesDeml/5802473b569718c9c86de906b7039aec
// Original https://gist.github.com/ulrikdamm/338392c3b0900de225ec6dd10864cab4
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
@swannodette
swannodette / inference.md
Last active August 7, 2023 16:13
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

@gcanti
gcanti / type_safe_event_emitter.md
Created November 5, 2016 08:38
Type safe event emitter with Flow
// A is a phantom type that ties an event instance...
class Event<A> {}
// ...to its handler
type Handler<A> = (a: A, ...rest: Array<void>) => void;

declare class EventEmitter {
  on<A, F: Handler<A>>(event: Event<A>, handler: F): void;
  emit<A>(event: Event<A>, a: A): void;
}
@mthadley
mthadley / .projections.json
Last active October 21, 2022 16:14
A configuration for using vim-projectionist with jest. I was looking for this but couldn't find it anywhere.
{
"**/__tests__/*.js": {
"alternate": "{}.js",
"type": "test"
},
"*.js": {
"alternate": "{dirname}/__tests__/{basename}.js",
"type": "source"
}
}
@0XDE57
0XDE57 / config.md
Last active April 18, 2024 04:36
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

anonymous
anonymous / ASS.md
Created June 26, 2015 23:11
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@bradp
bradp / setup.sh
Last active April 19, 2024 05:21
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install