Skip to content

Instantly share code, notes, and snippets.

View cathyxz's full-sized avatar

Cathy Zhu cathyxz

View GitHub Profile
// Scraping Made Easy with jQuery and SelectorGadget
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga)
// by David Trejo
//
// Install node.js and npm:
// http://joyeur.com/2010/12/10/installing-node-and-npm/
// Then run
// npm install jsdom jquery http-agent
// node numresults.js
//
@cathyxz
cathyxz / prepare-commit-msg
Last active January 24, 2017 07:49
verify release merge
#!/bin/sh
# Pre-merge hook that lists all commits and asks you if you really want to
# merge them in. For release branches only.
case $2 in
merge)
branch=$(grep -o "release/[0-9]\.[0-9]" $1)
if [[ ! -z $branch ]]
then
@cathyxz
cathyxz / pre-commit
Created January 26, 2017 04:44
Pre-commit hook to reject commit if you have added console.logs
#!/bin/sh
count=`git diff HEAD | grep '+.*console\.log' | wc -l | awk '{print $1}'`
if [[ "$count" -ge 1 ]]; then
echo "Please remove console.log() statements from your changes before committing."
echo "Refusing to commit changes."
git diff HEAD | grep '+.*console\.log'
exit 1
fi
@cathyxz
cathyxz / countries.json
Last active December 19, 2017 23:33
Country Names in Json
{
"items": [{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "land Islands",
"code": "AX"
}
]
@cathyxz
cathyxz / Stacktrace
Created February 23, 2018 03:06
amp validator stacktrace on travis
Failures:
1) ValidatorFeatures amp-facebook-page/0.1/test/validator-amp-facebook-page.html
Message:
AssertionError:
amp-facebook-page/0.1/test/validator-amp-facebook-page.out:1:0
expected:
PASS
| <!--
| Copyright 2018 The AMP HTML Authors. All Rights Reserved.
|
@cathyxz
cathyxz / search.md
Last active September 18, 2018 23:15
Github Search Things

Search Expression for all PRs created since date reviewed by me but not authored by me.

is:pr created:>=2018-03-01 reviewed-by:cathyxz -author:cathyxz 
@cathyxz
cathyxz / event-testing.md
Created October 1, 2018 20:27
Lessons Learned on Testing Events

CreateCustomEvent events don't bubble by default. So if you listen to something on the window, and create a custom event to test it, you need to make sure that the event bubbles.

@cathyxz
cathyxz / git-stuff.md
Last active December 19, 2018 22:05
Git / Github Swiss Army Knife

I need to

pull someone else's repo

git remote add coworker git://path/to/coworkers/repo.git
git fetch coworker
git checkout --track coworker/foo
git checkout foo
git pull
AMP.setLogLevel(4)
@cathyxz
cathyxz / gist:54faee538a7a9ee9375cfb07f92d7c9b
Created April 24, 2019 17:34
Single item list example
<amp-list class="i-amphtml-element i-amphtml-layout-fill i-amphtml-layout-size-defined i-amphtml-layout fill-list fill-list-show" [class]="searchState.inputValue == '' ? 'fill-list' : 'fill-list fill-list-show'" credentials="include" [src]="searchState.inputValue ? autosuggest.autoSuggestSearch + encodeURIComponent(searchState.inputValue) : autosuggest.emptyAndInitialTemplateJson" layout="fill" single-item="data" items="data" id="auto-prom-suggest" noloading="" i-amphtml-layout="fill" aria-live="polite" src="https://m.aliexpress.com/api/search/auto-suggests/dress">
<template type="amp-mustache">
<div class="s-seller">
{{#autoSuggestPromList}}
<a href="{{action}}&amp;spm=a2g0n.home-amp" class="auto">
<div class="prom flex align-center">
{{#icon}}
<amp-img src="{{icon}}" class="prom-image" alt="image" width="60" height="30" layout="fixed"></amp-img>