Skip to content

Instantly share code, notes, and snippets.

jeffreymeng /
Last active Apr 25, 2022
Gatsby React Firebase Authentication Hook

As opposed to useAuthState in react-firebase-hooks (which doesn't work with gatsby builds), this is designed to work with gatsby-plugin-firebase.

Requires React and firebase

Usage example:

import firebase from "gatsby-plugin-firebase"
import useAuthState from ...
View gitsync
BASE_PATH="~/Documents/code/"#change this to suit your needs
if [ "$#" == 0 ]
echo "Gitsync: Invalid Usage. See gitsync --help for more information"
elif [ "$1" == "--help" ] || [ "$1" == "--usage" ]
package BlackJackCopy;
import java.awt.*;
import javax.swing.*;
public class GUI extends JPanel{
final int width = 800;
final int height = 600;
package blackjack;
class Card {
public int number;//1 is ace, 2 is two, 13 is king
public int suit;//1 is club, 2 is diamond, 3 is heart, 4 is spade
public Card(int number, int suit) {//make a new card
this.number = number;
View gist:42a4ed0e8407b1187e8a94b931000a30
#include "stdafx.h"
#include "UVa11235.h"
#include <iostream>
#include <list>
#include <map>
#include <algorithm>
View gitsync.command
BASE_PATH="UNKNOWN - edit this by changing the variable in the gitsync file."
if [ "$#" == 0 ]
echo "Gitsync: Invalid Usage. See gitsync --help for more information"
elif [ "$1" == "--help" ] || [ "$1" == "--usage" ]
jeffreymeng / auto image in new
Last active Aug 26, 2017
Works on any html file with images(word file saves as html, raw html file, etc.)
View auto image in new

Usage: Works on any html file. When you have any html file with images(using src tag), and a user clicks on an image element, that image(the src) will automatically open in a new tab or window(depending on user/browser prefrence)

All you have to do is include the quick-use.html file's raw code(the script element and its contents) and add it to the end of your html(right before the closing body tab, or with all your other scripts. AFTER the images).

View Jquery-Replacement-Utility-Code-main-code.js
//this is just the base code. To see a usage example, see Jquery-Replacement-Utility-Code-example-code.js
var getElement = function(selector) { // or var $ = function(selector) {
var wrapper = document.querySelector(selector);
// get Dom wrapper.
//function to add custom functions to the wrapper.
this.addFunction = function(name, code) {
// if code is undefined, assume name is an object with name:function pairs
//enumerate the object name
jeffreymeng / libaryTemplate.js
Last active Aug 14, 2016
A Template for a javascript library, with some utilities included
View libaryTemplate.js
/* Copyright (c) 2016 Jeffrey Meng | MIT License
* Partially taken from and/or
(function(window) {
'use strict';
function define_Library() {
var throwError = function(txt, type) {
//throws an error
# Wordlist and getRandomWord functions Copyright 2016 Jeffrey Meng
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,