Skip to content

Instantly share code, notes, and snippets.

View jonmchan's full-sized avatar

Jonathan Chan jonmchan

View GitHub Profile
@jonmchan
jonmchan / Calculator.php
Created January 17, 2013 19:15
PHP Unit Testing Example Code
<?php
// Calculator.php
class Calculator {
public function getNumberFromUserInput() {
// complicated function to get number from user input
}
public function printToScreen($value) {
// another complicated function
}
@jonmchan
jonmchan / gist:8119260
Created December 25, 2013 01:00
brew doctor
brew doctor
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libmacfuse_i32.2.dylib
/usr/local/lib/libmacfuse_i64.2.dylib
/usr/local/lib/libosxfuse_i32.2.dylib
/usr/local/lib/libosxfuse_i64.2.dylib
brew install -V php54
==> Downloading http://www.php.net/get/php-5.4.23.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php54-5.4.23
==> Patching
patching file configure
Hunk #1 succeeded at 39208 (offset 931 lines).
Warning: Backing up all known pear.conf and .pearrc files
Warning: If you have a pre-existing pear install outside
of homebrew-php, or you are using a non-standard
pear.conf location, installation may fail.
$ php phpunit.phar
PHPUnit 4.1.2 by Sebastian Bergmann.
Configuration read from /Users/jonathan/code/updates/vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/phpunit.xml.dist
...........................................EEEEEEEEEEEEEEEEEE
Time: 9.08 seconds, Memory: 38.00Mb
There were 18 errors:
@jonmchan
jonmchan / PantoneGraphMLScrapeScripts.sh
Last active February 26, 2024 17:45
All Pantone Colors Codes to RGB Mapping Exploratory Findings
# in order to find how many colors are available, I reverse-engineered Pantone's color finder: https://www.pantone.com/color-finder
curl 'https://4n6dg5ccsfct3lzfssu34boemq.appsync-api.us-east-1.amazonaws.com/graphql' -H 'Accept: application/json, text/plain, */*' -H 'Referer: https://www.pantone.com/color-finder' -H 'Origin: https://www.pantone.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36' -H 'x-api-key: da2-sa3lsp2tkzhj3c2ysxbdprl73e' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"query":"\n {\n getColors {\n count\n totalCount\n maxResults\n colors {\n code\n name\n rgb {r g b}\n book {\n id\n title\n group\n sortIndex\n url\n info {\n en { target description }\n

Keybase proof

I hereby claim:

  • I am jonmchan on github.
  • I am jonmchan (https://keybase.io/jonmchan) on keybase.
  • I have a public key ASBLFyrkAfM7erDSGI1obupfuFjM_14wzRoE4R55xJBzDQo

To claim this, I am signing this object:

Restoring an utterly destroyed DFSR-replicated SYSVOL from backup

Warning: this is not official Microsoft documentation and some of these steps might not actually be supported.

This guide is provided "as is", without warranty of any kind, express or implied. In no event shall the authors or copyright holders be liable for any claim, damages or other liability arising from, out of or in connection with applying the steps outlined in this guide.

When to use

@jonmchan
jonmchan / generate_gh_release_notes.sh
Created January 11, 2024 17:58
Generate Release Notes From Merged PRs
#!/bin/bash
## Looks for the last release that was merged into master with the name "release", this allows for hotfixes to be included in the PR Changelog
last_release=`gh pr list -s merged --base master|grep 'release'|awk 'NR==1{print $1}'`
merged_prs=`gh pr list -s merged --limit 10 --search sort:updated-desc --json number,title --template '{{range .}}{{printf "#%.0f \n" .number}}{{end}}' |sed "/$last_release/q"`
formatted_prs=`echo "$merged_prs"| awk '{print " - " $0}'`
pr_body="## Features & Bug Fixes"$'\n'
pr_body+=""$'\n'