Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Chin alexpchin

View GitHub Profile
@alexpchin
alexpchin / screen-gif.sh
Created Jan 4, 2021 — forked from julesjans/screen-gif.sh
Capture iOS Simulator to animated gif
View screen-gif.sh
# Turn on the simulator screen capture
xcrun simctl io booted recordVideo ~/simulator.mov
# Convert the iPhone 6s screen shot into a gif:
ffmpeg -i ~/simulator.mov -vf scale=320:-1 -r 6 -f gif -y simulator.gif
@alexpchin
alexpchin / S3-Static-Sites.md
Created Jul 16, 2020 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.
View S3-Static-Sites.md

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@alexpchin
alexpchin / tags.js
Created Feb 28, 2019
Trying to get the tags to be highlighted
View tags.js
import React from "react";
import { StyleSheet, View, FlatList, Text } from "react-native";
import { connectInfiniteHits, connectHighlight } from "react-instantsearch-native";
import { uniqBy } from "lodash";
const Highlight = connectHighlight(
({ highlight, attribute, hit, highlightProperty }) => {
const parsedHit = highlight({
attribute,
hit,
View gist:2c6bd5917f5173c65daa3bb5e97b930f
watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache verify && yarn install && yarn start -- --reset-cache
View Stats
## Android
Active files: 471
Active lines: 56,744
Total commits: 822
Note: Files matching MIME type image, binary has been ignored
+----------------+--------+---------+-------+--------------------+
| name | loc | commits | files | distribution (%) |
View GithubStats.md

Number of lines in a repo:

git ls-files | xargs wc -l

Breakdown of lines in a repo by contributor:

git ls-files | while read f; do git blame -w -M -C -C --line-porcelain "$f" | grep -I '^author '; done | sort -f | uniq -ic | sort -n
@alexpchin
alexpchin / gist:2ced507ab4640b3bc52483933af56e7b
Last active Feb 7, 2018
Convert all js to ts recursively
View gist:2ced507ab4640b3bc52483933af56e7b
find . -iname "*.js" -exec bash -c 'mv "$0" "${0%\.js}.ts"' {} \;
View mongo-autostart-osx.md

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

View gist:a039af9e1eb93e2f1f26872218d937e5
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
git push --all --force
View gist:d524d9358ccdf33ba1c8cd794626df84
Here is one thing you can do.
Copy the image you want to multiply. (CtrlA and CtrlC)
Make a new 'Black' color layer and click 'add mask'.
alt-click the Mask icon, so that you can enter to mask edit mode.
Paste your 'multiply' images in the mask (b/w) , and then invert it.
You will have a black layer with your multiply material masked.
You can adjust opacity of that layer to find best looking image. (30~40%?)
If you save it as transparent PNG file, you are done.