Skip to content

Instantly share code, notes, and snippets.

@glocore
glocore / index.html
Last active December 6, 2022 10:15
[Electron Fiddle] Passing messages between renderer and a UtilityProcess using MessagePorts
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>
@glocore
glocore / openBrowser.ts
Last active October 30, 2022 03:29
Node script to open a URL in an existing tab in a Chromium browser, similar to create-react-app's dev server.
// Reference: https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/openBrowser.js
import { execSync } from "child_process";
import open from "open";
import defaultBrowserId from "default-browser-id";
import path from "path";
async function startBrowserProcess(url: string) {
const shouldTryOpenChromiumWithAppleScript = process.platform === "darwin";
if (shouldTryOpenChromiumWithAppleScript) {
@glocore
glocore / AppDelegate.md
Last active March 6, 2021 07:34
React Native Navigation (RNN) manual installation for iOS
 #import <React/RCTBundleURLProvider.h>
 #import <React/RCTRootView.h>
 #import <React/RCTLinkingManager.h>
+#import <ReactNativeNavigation/ReactNativeNavigation.h>

 #import <UMCore/UMModuleRegistry.h>
 #import <UMReactNativeAdapter/UMNativeModulesProxy.h>

 - (RCTBridge *)initializeReactNativeApp
@glocore
glocore / zsh.md
Created December 12, 2017 13:21 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@glocore
glocore / SyntheticEventExample.jsx
Last active September 27, 2017 19:13
SyntheticEvent Example
import React, {Component} from 'react'
import _ from 'lodash'
export default class App extends Component {
onChange(event) {
console.log(event.target.value)
}
render() {
return (
<div>
@glocore
glocore / debounceExample.js
Created September 27, 2017 18:25
debounce function example
function greet() {
console.log('hello')
}
var debouncedFunction = _.debounce(greet, 500)
window.addEventListener('scroll', debouncedFunction)
@glocore
glocore / guidelines.md
Last active September 21, 2018 21:01
Coding Styleguides and Github Guidelines
@glocore
glocore / Preferences.sublime-settings
Created June 25, 2017 02:40
My Sublime 3 Settings
{
"auto_complete_commit_on_tab": true,
"auto_indent": true,
"bold_folder_labels": true,
"close_windows_when_empty": false,
"color_scheme": "Packages/Oceanic Color Scheme/Themes/Oceanic - Eighties.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
@glocore
glocore / Instructions.md
Created March 18, 2017 17:40
Setup React Native on Ubuntu 16.04/16.10

1. Install Node.js

  • Follow the steps given here to install Node.js and NPM.
  • Verify whether NPM is installed by typing npm -v in a terminal window.

2. Install React Native CLI

  • npm install -g react-native-cli

3. Setup Android Development Environment

  • Download and install Android Studio as explained here.
  • Run Android Studio and open the SDK Manager. Under the SDK Platforms tab, check Show Package Details, expand Android 6.0 (Marshmallow) and check the following: