Skip to content

Instantly share code, notes, and snippets.

View orion110217's full-sized avatar

Patrick Buitre orion110217

View GitHub Profile
@orion110217
orion110217 / mongoconsole.sh
Created August 22, 2017 10:02 — forked from stanislavb/mongoconsole.sh
Backup and restore MongoDB running in a Docker container
#!/bin/bash
usage() {
echo "Usage $0 -c mongo_docker_container_name"
}
while [[ $# > 1 ]]
do
key="$1"
@orion110217
orion110217 / lesson-read.me
Created February 1, 2018 02:58
FB SDK async loading in React
FB SDK is designed to not block you page. So it will not be ready as soon as you think it's ready (componentWillMount).
So do it like this if you want to make it your logged in criteria:
Create a component that will load the script:
class LoggedIn extends Components{
this.state = { isLoggedIn: false, loading: true }
componentDidMount(){
@orion110217
orion110217 / localStorage.txt
Last active June 9, 2020 21:00
Polyfills localStorage and sessionStorage when cookies are disabled.
const hasLocalStorage = (function(){
try {
localStorage.setItem('mod', 'mod');
localStorage.removeItem('mod');
return true;
} catch(e) {
return false;
}
})()