Skip to content

Instantly share code, notes, and snippets.

View erickzhao's full-sized avatar
:atom:
:hurtrealbad: :goberserk: :finnadie:

Erick Zhao erickzhao

:atom:
:hurtrealbad: :goberserk: :finnadie:
View GitHub Profile

Background

For migrating the Node APIs from the renderer process to the main process, the IPCRenderer API is to be moved to preload scripts and then exposed in the renderer process via the contextBridge API.
The below diagram explains it better -
Image

@almonk
almonk / SnappyWindow.swift
Last active May 2, 2024 03:05
SnappyWindow – A NSWindow that acts like the PIP Video Window from Safari
//
// SnappyWindow.swift
// A NSWindow that snaps to corners
//
// Created by Alasdair Monk on 03/02/2021.
//
import Foundation
import Cocoa
@uditalias
uditalias / custom.css
Created September 21, 2020 20:32
Adding line numbers to Docusaurus 2 CodeBlocks using only CSS
/* Edit the `src/css/custom.css` file and add the following styles */
/*
* Reset the line-number counter for each .prism-code scope
*/
.prism-code {
counter-reset: line-number;
}
/*
@gatsbyjs-employees
gatsbyjs-employees / Open letter to the Gatsby community.md
Last active February 23, 2021 00:24
Open letter to the Gatsby community

To the Gatsby Community,

We want to start by specifically thanking Nat Alison. We support her and commend her bravery in speaking out. It is not easy to stand alone. What she experienced at Gatsby was unacceptable and speaks to wider issues. We thank her for putting pressure on the company to fix them. We vow to double down on those efforts.

While we have worked hard to give feedback and help create a healthy work environment over the past few years, change has been far too slow and the consequences have been real. The previous weeks have intensified the need for rapid change by increasing employee communication and allowing us to collectively connect some dots. We are just as outraged. As a result, we have posed a series of hard questions to management as well as a list of concrete actions they need to take.

Kyle Mathews' public apologies to both Nat Alison and Kim Crayton are small actions swiftly taken that signal the possibility for change but don't speak to the systemic issues that must be addressed.

@VerteDinde
VerteDinde / electron-openjs.md
Last active June 23, 2020 21:05
Electron + OpenJS: Additional Resources

Welcome! 👋

If you're here, you may have watched Electron's OpenJS keynote and are looking for additional resources. We're happy that you're interested in Electron!

Below are a list of all of the resources listed in the keynote, as well as some additional links that you may find helpful.

I'd like to learn more about Electron!

@erickzhao
erickzhao / POWERHOUR.js
Last active July 31, 2020 01:48
Power Hour Runner
const buttons = {
next: document.querySelector('[title="Next"]'),
play: document.querySelector('[title="Play"]'),
}
// CONFIGURATION CONSTANTS
const HORN_LINK = 'https://raw.githubusercontent.com/bread-gang/SAAS/master/airhorn.mp3'; // change horn sound
const SONG_TIME = 60000; // in ms
const NUM_SONGS = 60; // change number of songs played
const NUM_END_SONGS = 1; // number of songs to play in full at the end
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 1, 2024 09:43 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@ftvs
ftvs / CameraShake.cs
Last active April 17, 2024 23:08
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
@cobyism
cobyism / gh-pages-deploy.md
Last active May 6, 2024 08:07
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).