Skip to content

Instantly share code, notes, and snippets.


Josh Moncrieff monners

  • Bueno Systems
  • Melbourne
View GitHub Profile
monners / email_valid.php
Created September 28, 2012 01:12
php - validateEmailAddress
View email_valid.php
function check_email_address($email) {
// First, we check that there's one @ symbol,
// and that the lengths are right.
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters
// in one section or wrong number of @ symbols.
return false;
// Split it into sections to make life easier
$email_array = explode("@", $email);
monners / gist:3798424
Created September 28, 2012 07:16
javascript - Continous function call
View gist:3798424
window.onload = function() {
setInterval( rotate, 50);
monners / gist:3798438
Created September 28, 2012 07:21
javascript - continuous loop
View gist:3798438
var Loop = function() {
setTimeout(Loop, 10);
window.onload = Loop;
View gist:6061271

So, you want to send a motherfucking XMLHttpRequest (XHR, or commonly and falsly known as AJAX.) Too bad, just ran out of motherfucking XMLHttpRequests; but I still have one regular. XHR is not magic. It does not autofuckinmagically send things the way you want them do be sent. It does not do the thinking for you. It just sends an Http Request.

You get a hold on such a prime beast like this:


"Knowledge is knowing a tomato is a fruit. Wisdom is not putting it in a fruit salad" -Anonymous

One common refrain from experienced engineers outside of Silicon Valley is that 'nothing SV cranks out requires any talent (arubin)'. Seeing that I'm an engineer (albeit junior) turning that very same SV crank, I immediately took offense. What?!? How could anyone say that these amazing new apps put together with generators, Bootstrap and the latest over-hyped database....Alright, I'll concede that point. As I've thought about this more, I've found some truth in the statement - but not as much as those who spout it might want. There's plenty of evidence that both sides are equally correct, just in different microcosms.

Before going any further, let's define a few terms.

  • Knowledge is anything you can look up.
  • Talent is anything you can't look up.

Gluing together a MVP calendar app with Bootstrap, Angular and a Mongo wrapper takes knowledge. Building something people can love and use for years takes

monners /
Created March 3, 2015 00:58

Keybase proof

I hereby claim:

  • I am monners on github.
  • I am monners ( on keybase.
  • I have a public key whose fingerprint is B7BA CD01 B9B6 0A85 0A17 6B5C 7ED8 11C6 CD16 6BDD

To claim this, I am signing this object:


How do you add a list of image links to a document?

Suppose I have an array full of image source URLs, like:

var imgs = ['', '', '', ''];

How do I grab all of those images and insert them into my page at a particular location? Say...

<div id="imageContainer"></div>
monners / keymap.cson
Last active September 28, 2017 21:06
Atom keymap.cson
View keymap.cson
# Your keymap
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
# Here's an example taken from Atom's built-in keymap:
View simple-parallax-fade.js
/* jshint browser: true */
'use strict';
var viewportWidth = window.innerWidth || document.body.clientWidth;
var parallaxRange = 130; // How far the background moves from its starting position
var backgroundImages = []'.bannerlax .banner-image'));
var content = []'.bannerlax .banner-heading'));
monners / basic-responsive-images.js
Last active September 9, 2015 04:57
A super basic responsive images and lazy load module
View basic-responsive-images.js
/* jshint browser: true, debug: true */
'use strict';
// init({
// baseUrl: 'data-img-desktop', // will be used as largest, AND default if no other responsive tags are used
// responsive: [ // Array of breakpoint objects
// {
// breakpoint: 1024,