Skip to content

Instantly share code, notes, and snippets.

View smashboy's full-sized avatar
🌴

SmashBoy smashboy

🌴
View GitHub Profile
@smashboy
smashboy / index.ts
Last active March 15, 2021 16:41
Next API Routes / Pusher Issue
// Pusher setup in separate file
import Pusher from "pusher";
const pusher = new Pusher({
appId: process.env.PUSHER_APP_ID,
key: process.env.NEXT_PUBLIC_PUSHER_KEY,
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER,
secret: process.env.PUSHER_SECRET,
});
@smashboy
smashboy / usePusher.rs
Created March 5, 2021 19:36
React hook usePusher
import React from "react";
import Pusher, { Channel } from "pusher-js";
const pusher = new Pusher(process.env.NEXT_PUBLIC_PUSHER_KEY, {
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER,
});
type EventPropsType<R> = {
event: string;
onEvent: (data: R) => void;
@smashboy
smashboy / appWindow.ts
Created September 7, 2020 09:59
appWindow
import { BrowserWindow, app } from 'electron';
import { connections } from '../../main';
import { closePreloaderWindow } from '../preloaderWindow/preloaderWindow';
let appWindow: null | BrowserWindow = null;
export const createAppWindow = () => {
appWindow = new BrowserWindow({
width: 970,
height: 610,