Skip to content

Instantly share code, notes, and snippets.

View jason-shen's full-sized avatar
🗼
Coding........

Jason Shen jason-shen

🗼
Coding........
View GitHub Profile
@jason-shen
jason-shen / volume_meter.html
Created April 20, 2021 05:46 — forked from yying/volume_meter.html
WebAudio volume meter using a MediaStream (can be easily applied to MediaStream from WebRTC)
<!DOCTYPE html>
<html lang="en">
<head>
<title> </title>
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/min/1.5/min.min.css">
<style>
body,textarea,input,select {
background:0;
border-radius:0;
font:16px sans-serif;
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@jason-shen
jason-shen / gist:620361bced194dfe5f3f4454759a2314
Created January 13, 2021 07:43 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jason-shen
jason-shen / access_postgresql_with_docker.md
Created December 9, 2020 17:06 — forked from MauricioMoraes/access_postgresql_with_docker.md
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

useEffect(() => {
console.log(“ComponentDidUpdate”
});
useEffect(() => {
console.log(“ComponentDidMount”
},[]);
useEffect(() => {
console.log(“will run when x changes”
userEffect(() => {
console.log(“ComponentDidUpdate”
});
userEffect(() => {
console.log(“ComponentDidMount”
});
userEffect(() => {
console.log(“will run when x changes”
#lock
defaults write com.apple.dock contents-immutable -bool true
#unlock
defaults write com.apple.dock contents-immutable -bool false
@jason-shen
jason-shen / RN_flatList_example.js
Created July 2, 2020 18:11 — forked from SergeyLipko/RN_flatList_example.js
Example of using RN FlatList component with pagination and pull-refreshing
import React from 'react';
import {
View,
Text,
FlatList,
StyleSheet
} from 'react-native';
import { ListItem } from 'react-native-elements';
class Users extends React.Component {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
@jason-shen
jason-shen / .bashrc
Created April 25, 2020 17:52 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin