Skip to content

Instantly share code, notes, and snippets.

@dblazeski
dblazeski / DeleteChromeMac
Created September 10, 2019 12:57
Deletes chrome on mac
Scripts that deletes chrome on mac and leftovers
# https://superuser.com/a/318205
rm -r /Applications/Google\ Chrome.app/
rm -r ~/Library/Application\ Support/Google/Chrome/
rm ~/Library/Application\ Support/CrashReporter/Google\ Chrome*
rm ~/Library/Preferences/com.google.Chrome*
rm ~/Library/Preferences/Google\ Chrome*
rm -r ~/Library/Caches/com.google.Chrome*
rm -r ~/Library/Saved\ Application\ State/com.google.Chrome.savedState/
@dblazeski
dblazeski / SideMenuParentScreen.js
Created June 22, 2019 14:18
SideMenuParentScreen used for ReactNative
// This gist is part of a medium post - https://medium.com/p/8e03510b8cc1/
import React, { Component } from "react";
import { StyleSheet, Dimensions, Button } from "react-native";
import Modal from "react-native-modal";
import SideMenu from "./SideMenu";
const { width } = Dimensions.get("window");
const styles = StyleSheet.create({
@dblazeski
dblazeski / SideMenu.js
Last active June 22, 2019 14:04
SideMenu screen used for ReactNative
// This gist is part of a medium post - https://medium.com/p/8e03510b8cc1/
import React from "react";
import { SafeAreaView, Text, View, Switch } from "react-native";
const styles = StyleSheet.create({
safeAreaView: {
flex: 1,
backgroundColor: "#fff"
},
container: {
@dblazeski
dblazeski / calltapOnTabNavigator.js
Last active February 7, 2019 12:10
Register our local function linked to defaultNavigationOptions - tapOnTabNavigator
// for registering the caller "tapOnTabNavigator"
// see https://gist.github.com/dblazeski/1e86142e0a8548bcde9b78c71846b3f9
export default class SearchScreen extends React.Component {
componentDidMount() {
// Register our local function called by
// tabBarOnPress() in defaultNavigationOptions()
this.props.navigation.setParams({
tapOnTabNavigator: this.tapOnTabNavigator
@dblazeski
dblazeski / registerTabBarOnPress.js
Last active March 12, 2023 17:51
Call screen function tapOnTabNavigator when tab bar is pressed
// When the tab bar is pressed and the screen is focused, check if the screen component has tabOnTabNavigator function and call it
// For the screen function see https://gist.github.com/dblazeski/e7677db0d209c03713b24fcf00443c0e
const getScreenRegisteredFunctions = navState => {
// When we use stack navigators.
// Also needed for react-navigation@2
const { routes, index, params } = navState;
if (navState.hasOwnProperty('index')) {
return getScreenRegisteredFunctions(routes[index]);
@dblazeski
dblazeski / didFocusListener.js
Last active February 7, 2019 12:30
Register screen focus listener, onScreenFocus() called when the screen is focused initially
class HomeScreen extends React.Component {
componentDidMount() {
// Listen for screen focus event
this.props.navigation.addListener('didFocus', this.onScreenFocus)
}
// Called when our screen is focused
onScreenFocus = () => {
// Screen was focused, our on focus logic goes here
@dblazeski
dblazeski / gist:b800064ad258a7893b2380d86c160ac3
Created October 2, 2018 13:00
Ubuntu 16.04 server - change timezone
In the terminal run and follow the onscreen prompts:
$ sudo dpkg-reconfigure tzdata
@dblazeski
dblazeski / gist:eeaefd2dea696241b9b4576bdb9be2a6
Last active September 5, 2018 19:54
Set timezone on Ubuntu 16
In terminal, run and follow the onscreen wizzard:
sudo dpkg-reconfigure tzdata
@dblazeski
dblazeski / nginx.conf
Created October 31, 2017 14:34
Nginx - Forces HTTPS redirect on all requests and strip WWW prefix
# Forces HTTPS redirect on all requests
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
@dblazeski
dblazeski / show broken images in firefox
Created December 28, 2013 16:31
Show placeholders for broken images in firefox. To use this, just add it in your stylesheet file while developing. http://stackoverflow.com/a/4715893
/* Force Firefox to show image placeholders
----------------------------------------------------------*/
@-moz-document url-prefix(http), url-prefix(file) {
img:-moz-broken {
-moz-force-broken-image-icon: 1;
width: 100px;
height: 75px;
}
}