Skip to content

Instantly share code, notes, and snippets.

View monners's full-sized avatar

Josh Moncrieff monners

  • Bueno Systems
  • Melbourne
View GitHub Profile
@monners
monners / keymap.cson
Last active September 28, 2017 21:06
Atom 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:

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 = ['http://lorempizza.com/380/240', 'http://dummyimage.com/250/ffffff/000000', 'http://lorempixel.com/g/400/200/', 'http://lorempixel.com/g/400/200/sports/'];

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

<div id="imageContainer"></div>
@monners
monners / keybase.md
Created March 3, 2015 00:58
keybase.md

Keybase proof

I hereby claim:

  • I am monners on github.
  • I am monners (https://keybase.io/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:

"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

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:

@monners
monners / gist:3798438
Created September 28, 2012 07:21
javascript - continuous loop
var Loop = function() {
someFunction();
setTimeout(Loop, 10);
};
window.onload = Loop;
@monners
monners / gist:3798424
Created September 28, 2012 07:16
javascript - Continous function call
window.onload = function() {
setInterval( rotate, 50);
};
@monners
monners / email_valid.php
Created September 28, 2012 01:12
php - validateEmailAddress
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);