Skip to content

Instantly share code, notes, and snippets.

View justinfarrelldev's full-sized avatar

Justin Farrell justinfarrelldev

View GitHub Profile
@jericbas
jericbas / search.tests.js
Created June 21, 2019 05:05
Mock `window.location.search`
it('mocks search', () => {
delete window.location;
window.location = { search: '?query=phone' };
expect(window.location.search).toEqual('?query=phone');
});
@endel
endel / getMoonPhase.js
Created March 25, 2015 16:04
Get Moon Phase by Date, written in JavaScript
/*
* modified from http://www.voidware.com/moon_phase.htm
*/
function getMoonPhase(year, month, day)
{
var c = e = jd = b = 0;
if (month < 3) {
year--;