Skip to content

Instantly share code, notes, and snippets.

Will C. wichopy

Block or report user

Report or block wichopy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View google-login.js
var provider = new firebase.auth.GoogleAuthProvider();
function onSigninClick () {
firebase.auth().signInWithPopup(provider).then(function (result) {
console.log('Auth resposne from firebase:', result)
function onSignoutClick () {
firebase.auth().signOut().then(function() {
wichopy / higher_order_single_click.js
Last active Aug 16, 2018
higher order single click function
View higher_order_single_click.js
//Wrap an onclick handler
const once = fn => {
let done = false;
return (...args) => {
if (!done) {
done = true;
wichopy /
Last active Jul 23, 2018
CORS requests


  • web applications makes a CORs request when it requests a resource that has a different origin (domain, protocol, port) then its own origin.
  • CORS is for security reasons, browsers restrict cross-origin HTTP requests initiated within scripts
  • HTTP Header that allows servers to describe the set of origins that are permitted to read that information using a web browser.
  • HTTP requests that can cause side-effects on server's data, browser must pre-flight the request (HTTP OPTIONS method), After approval, the server will send the actual request back to the browser.
  • Allowed Methods:
    • GET
    • HEAD
    • POST
wichopy / webpack-docker-package-conf.json
Created Jul 12, 2018
Connecting webpack dev server to an api hosted locally in a docker container
View webpack-docker-package-conf.json
"proxy": {
"/server": {
"target": "",
"changeOrigin": true
wichopy /
Created Jul 1, 2018
PM2 start npm script with environment variables injected.
pm2 start npm --name [process name] -- run [npm script name] ENV_VAR=some_env_var_value
wichopy /
Created May 1, 2018
Redeploy server war and restart postgres docker container locally.
echo "Stop tomcat";
echo "Restart postgres container";
#Assuming you have docker, with a postgres container running called local-postgres. The postgres container can be renamed in the docker run command.
docker stop local-postgres;
docker rm local-postgres;
docker run --name local-postgres -e POSTGRES_USER=user -e POSTGRES_DB=db -d -p 5432:5432 postgres;
wichopy / filterString.js
Created Feb 3, 2018
Filter out text strings using regex of a URL.
View filterString.js
// assuming env var
removebaseURL = (fullURL) => { // pass in (
// Allow api calls to handle just the end point (/kittens) or the full URL (
// by filtering out the base URL if the route contains it.
const reg = new RegExp(process.env.BASE_URL, 'gi');
const match = fullURL.match(r eg)
let endpoint
if (match) {
endpoint = fullURL.split(reg)[1]
wichopy / isolateKeys.js
Last active Jan 9, 2018
Immutable removal of keys from a javascript object using ES6 deconstructing.
View isolateKeys.js
//Avoid annoying immutability bugs by using this nice ES6 deconstructing trick to keep your object immutable.
// example obj
const someObj = {
want: 'this',
need: 'that',
dont: 'wantthis',
forget: 'this'
wichopy / Jenkinsfile.groovy
Created Nov 20, 2017 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
View Jenkinsfile.groovy
node {
echo 'No quotes in single backticks'
sh 'echo $BUILD_NUMBER'
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"'
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"'
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"'
echo 'Using three backslashes still results in preserving the single quotes'
wichopy / checkbox_extract_script.bas
Created Mar 19, 2017
Script to extract data from excel checkboxes.
View checkbox_extract_script.bas
Sub CheckboxLoop()
'Using this as a start:
'PURPOSE: Loop through each Form Control Checkbox on the ActiveSheet
Dim cb As Shape
Dim i As Integer
You can’t perform that action at this time.