Skip to content

Instantly share code, notes, and snippets.

View mbuttler's full-sized avatar

Matthew Buttler mbuttler

  • Ottawa, ON
View GitHub Profile
var compare = function(choice1,choice2)
{
if (choice1 === choice2) {
return "The result is a tie!";
}
else if (choice1 === "rock") {
if(choice2 ==="scissors") {
var isEven = function(number) {
// Your code goes here!
if (number % 2 === 0)
return true;
else
return false;
};
@mbuttler
mbuttler / friends-and-enemies
Last active August 29, 2015 14:22
Matt's Javascript Question of the Day
// behold, an object.
var neutralFolk = {};
// when I go to check this, I get an "unexpected token ." syntax error. Why?
var enemies = {
enemies.khan = {};
enemies.salazar = {};
@mbuttler
mbuttler / gist:84d850586c1a718aa9b6
Created June 3, 2015 14:37
Matt doesn't really know functions that well yet.
// First we define zee objects...
var friends = {
bill: {
firstName: "Bill",
lastName: "Grates",
number: "613-555-7310",
address: ['123 Any Street', 'Ottawa, ON', 'K2P 1Y8'] },
steve: {
firstName: "Steve",
lastName: "Jerbs",
@mbuttler
mbuttler / gist:b45dd4a736a4aadc6fac
Last active August 29, 2015 14:23
Matt's jQuery question 6/16
// So here's my jQuery script.
$(document).ready(function(){
$("#one").after("<p>Awesome funtimes for all!</p>");
$("#two").after($("p"));
$("p").remove();
});
//how does it know that by "p" I mean my paragraph? I don't declare it as a variable...
// but it still moves it after #two and removes it... why is that?
app.controller('MainController', ['$scope', function($scope) {
$scope.exercises = [
{
icon: 'img/pushup.jpg',
name: 'Pushups',
count: 20
},
{
icon: 'img/squat.jpg',
name: 'Squats',
<!doctype html>
<html>
<head>
<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
<link href='https://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
<link href="css/main.css" rel="stylesheet" />
<script src="js/vendor/angular.min.js"></script>
</head>
<body ng-app="MoveLogApp">
<div class="header">
@mbuttler
mbuttler / MainController.js
Created August 6, 2015 19:20
MainController.js in Built-in and Custom Directives
app.controller('MainController', ['$scope', function($scope) {
$scope.move = {
icon: 'img/move.jpg',
title: 'MOVE',
developer: 'MOVE, Inc.',
price: 0.99
};
$scope.shutterbugg = {
icon: 'img/shutterbugg.jpg',
@mbuttler
mbuttler / index.html
Created August 6, 2015 19:22
index.html in Built-in and Custom Directives
<!doctype html>
<html>
<head>
<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
<link href="css/main.css" rel="stylesheet" />
<!-- Include the AngularJS library -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
</head>
<body ng-app="AppMarketApp">
@mbuttler
mbuttler / MainController.js
Created August 7, 2015 22:36
Bolt Network Maincontroller
app.controller('MainController', ['$scope', function($scope) {
$scope.program = [
{
series: "Sherlock",
series_img: "img/sherlock.jpg",
genre: "crime drama",
season: 3,
episode: "The Empty Hearse",
description: "Two years after his reported Reichenbach Fall demise, Sherlock, who has been cleared of all fraud charges against him, returns with Mycroft's help to a London under threat of terrorist attack. John has moved on and has a girlfriend, Mary Morstan. Sherlock enlists Molly to assist him, but when John is kidnapped by unknown assailants and is rescued by Sherlock and Mary, John returns to help find the terrorists and an underground plot to blow up the Houses of Parliament during an all night sitting on Guy Fawkes Night.",