Skip to content

Instantly share code, notes, and snippets.

function makeRequest(url) {
httpRequest = new XMLHttpRequest();
if (!httpRequest) {
displayErrorMsg('Sorry, there was a problem making the request!');
return false;
}
httpRequest.onreadystatechange = receiveRequest;
httpRequest.open('GET', url);
httpRequest.send();
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Wow, Popcode is so COOL!</h1>
<p>I can't wait to use this with my students.</p>
</body>
</html>
<!DOCTYPE html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.3.1/redux.js"></script>
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
</head>
<body>
Current Count: <span id="current-count"></span>
<div>
@ahoef
ahoef / angular1vs2.js
Created January 21, 2016 21:45
Angular Controllers vs Components
//angular 1.x
//controller
angular.module('foo')
.controller('myMessage', function($scope) {
$scope.message = 'Look out for that rock!';
});
//view
<div ng-controller="myMessage">
<div id="hero">
<div id="hero-inner">
<h1>apostrophe</h1>
<a href="https://github.com/punkave/apostrophe" target="_blank" class="first">github</a>
<a href="#">installation video</a>
<h3>A description of Apostrophe goes here.</h3>
</div>
</div>