This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function store() | |
{ | |
$validator = Validator::make(Input::all(), Post::$rules); | |
if ($validator->fails()) { | |
Session::flash('errorMessage', 'Failed to save post!'); | |
return Redirect::back()->withInput()->withErrors($validator); | |
} else { | |
$post = new Post(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate a random integer between 1 and 100 each time the function is called. | |
function getRandom() { | |
return Math.floor(Math.random() * 101); | |
} | |
// Prompt the user for their guess and validate it. | |
function getNewGuess() { | |
var userGuess = parseInt(prompt('Input a number between 1 and 100')); | |
return validateOrRetryInput(userGuess); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../ace-element/ace-element.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-input/core-input.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"_id": "54e23c3e46ab53a440b580e8", | |
"index": 0, | |
"guid": "9962b468-ef3e-4993-b677-617469bc3008", | |
"isActive": false, | |
"balance": "$2,097.02", | |
"picture": "http://placehold.it/32x32", | |
"age": 39, | |
"eyeColor": "blue", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
// Produce a new object called var report and console.log it's contents | |
// Report should display | |
// - total number of profiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> | |
<style> | |
.board { | |
position: relative; | |
margin-bottom: 90px; | |
margin-left: auto; | |
margin-right: auto; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building a Todo List in PHP | |
Now that we have a good understanding of arrays, the command line, checking user input, and control structures, it is time to build an application that we'll be revisiting through-out the course. | |
A Todo List | |
The Specs | |
The application should run on command line, should prompt users to add new items, allow them to add text items, and the ability to remove completed items. | |
After each action, it should display the todo list and the menu. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Output should include: | |
// - total number of employees | |
// - total number of units sold | |
// - avg units sold per employee | |
// - Then output should share employee production, ordered from highest to lowest # of units | |
// * Units | Full Name | Employee Number | |
// * 5 Bob Boberson 2 | |
Monthly Sales Report | |
Date: 03-17-2015 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Why is this change necessary? | |
# How does it address the issue? | |
# What side effects does this change have? | |
# Other comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As soon as you create a new Laravel project, it will default itself to be in production mode (so that stack traces don't show up) and still needs you to put in $ENV placeholders for the database login credentials. Since we NEVER commit passwords or API keys to github, we need to use $ENV as a placeholder and then create .env.local.php in order to store the actual values. Your .env.local.php file is automatically ignored by git, so this is where you put your credentials. | |
In bootstrap/start.php on line 27, change to the following: | |
$env = $app->detectEnvironment(function() { | |
return isset($_SERVER['LARAVEL_ENV']) ? $_SERVER['LARAVEL_ENV'] : 'production'; | |
}); | |
Delete app/config/local/database.php file. | |
Edit app/config/database.php in the following way: |