Skip to content

Instantly share code, notes, and snippets.

View alexpchin's full-sized avatar

Alex Chin alexpchin

View GitHub Profile
@alexpchin
alexpchin / gist:23569420fd8fdce1d710a1a025d448e7
Created August 24, 2023 08:40
Example of populatePaymentPlan Group
{
"name": "A Payment Plan Group",
"plans": [
{
"name": "Monthly",
"invoices": [
{
"due_date": "2023-08-04T00:00:00.000Z",
"period_start": "2023-08-04T00:00:00.000Z",
"period_end": "2024-09-14T23:59:59.999Z",
const pw = require('playwright');
const UserAgent = require('user-agents');
const uuid = require('uuid');
const tmp = require('tmp-promise');
const UINT32_MAX = (2 ** 32) - 1;
const WEBGL_RENDERERS = ['ANGLE (NVIDIA Quadro 2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (NVIDIA Quadro K420 Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro 2000M Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro K2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (ATI Radeon HD 3800 Series Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (AMD Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D
@alexpchin
alexpchin / Session.js
Created May 5, 2021 18:58 — forked from JamesTheHacker/Session.js
Log into Facebook using cookies
'use strict'
let Promise = require('bluebird');
let fs = Promise.promisifyAll(require('fs'));
let Cheerio = require('cheerio');
let Request = require('request');
let ToughCookie = require('tough-cookie');
class Session {
@alexpchin
alexpchin / gist:8e2bb81ca0067b824a08fdc7e9b3711e
Created January 28, 2021 13:00
Delete all node_modules
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
@alexpchin
alexpchin / screen-gif.sh
Created January 4, 2021 16:37 — forked from julesjans/screen-gif.sh
Capture iOS Simulator to animated gif
# 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 July 16, 2020 06:50 — 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.

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 February 28, 2019 13:26
Trying to get the tags to be highlighted
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,
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
## 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 (%) |

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