Skip to content

Instantly share code, notes, and snippets.

View mbuttler's full-sized avatar

Matthew Buttler mbuttler

  • Ottawa, ON
View GitHub Profile
@mbuttler
mbuttler / posts_controller.rb
Created September 5, 2015 18:38
Threadly - Posts Controller
class PostsController < ApplicationController
def index
@new_post = Post.new
@all_posts = Post.order(created_at: :desc).all
end
def new
@new_post = Post.new
end
end
@mbuttler
mbuttler / commands.txt
Created September 2, 2015 02:01
What I type in the bash prompt
rails new MessengerApp
cd MessengerApp
ls
@mbuttler
mbuttler / index.html
Created August 10, 2015 13:55
outbox - index
<!doctype html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,700' rel='stylesheet' type='text/css'>
<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
<link href="css/main.css" rel="stylesheet" />
<script src="js/vendor/angular.min.js"></script>
</head>
<body ng-app="OutboxApp">
<div class="header">
@mbuttler
mbuttler / emails.js
Created August 10, 2015 13:55
outbox - emails.js
app.factory('email', ['$http', function($http) {
return $http.get('https://s3.amazonaws.com/codecademy-content/courses/ltp4/emails-api/emails.json')
.success(function(data) {
return data;
})
.error(function(err) {
return err;
});
}]);
@mbuttler
mbuttler / homecontroller.js
Created August 10, 2015 13:55
Outbox - HomeController
app.controller('HomeController', ['$scope', 'emails', function($scope, emails) {
emails.success(function(data) {
$scope.email = data;
});
}]);
<!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=Source+Sans+Pro:300,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="FeedsterApp">
@mbuttler
mbuttler / plusOne.html
Created August 8, 2015 13:49
feedster - plusOne.html
<button ng-click="like()" class="btn">+1</button>
@mbuttler
mbuttler / plusOne.js
Created August 8, 2015 13:48
AngularJS - Feedster PlusOne.js
app.directive('plusOne', function() {
return {
restrict: 'E',
scope: {
},
templateUrl: 'js/directives/plusOne.html',
link: function(like() {
function(scope, element, attrs) {
scope.like = function() {
element.toggleClass('btn-like');
@mbuttler
mbuttler / game.html
Created August 7, 2015 23:58
gameboard 1 - directive template
<div class="col-sm-4">
<div class="row scorecard">
<p class="period"> {{ info.period }} </p>
<div class="visitor col-xs-4">
<h2 class="visitor-score"> {{ info.visitor_score }} </h2>
<h3>
<span class="visitor-city"> {{ info.visitor_team.city }} </span><br/>
<span class="visitor-name"> {{ info.visitor_team.name }} </span>
</h3>
</div>
@mbuttler
mbuttler / index.html
Created August 7, 2015 23:58
gameboard 1 index.html
<!doctype html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<script src="js/vendor/angular.min.js"></script>
</head>