Skip to content

Instantly share code, notes, and snippets.

View J-Cake's full-sized avatar
🥚
Egg

Jacob Schneider J-Cake

🥚
Egg
View GitHub Profile
@J-Cake
J-Cake / Multi instance comms.js
Created January 16, 2019 13:01
How to only have one instance of a window open while feeding info into it.
let isMainWindow = false; // keep track of main instance.
// Of course the main instance should be kept track of in a better way than this, perhaps find a way of uniquely identifying the tabs
// and storing the ID of the active tab in localStorage.
window.addEventListener('load', e => {
if (!window.localStorage.mainWindowVacant) window.localStorage.mainWindowVacant = "true"; // initialsise window.localStorage
if (!window.localStorage.openInstances) window.localStorage.mainWindowVacant = "true"; // initialsise window.localStorage
if (window.localStorage.mainWindowVacant !== "false") {
@J-Cake
J-Cake / brightnessSlider.js
Last active January 14, 2019 05:16
My React-Native Drawing app, but without any interactivity
import React, {Component} from 'react';
import {View, Text, Dimensions} from 'react-native';
import styles from './styles.js';
import LinearGradient from 'react-native-linear-gradient';
import utils from './utils.js';
const d = Dimensions.get('window'),
width = d.width,
height = d.height;
export default class BrightnessSlider extends Component {