Skip to content

Instantly share code, notes, and snippets.

View ryanorsinger's full-sized avatar
🎏
Reading the readme... again :)

Ryan Orsinger ryanorsinger

🎏
Reading the readme... again :)
View GitHub Profile
@ryanorsinger
ryanorsinger / PostsController@store
Created October 15, 2014 16:53
Image Upload and associating an image to a post
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();
@ryanorsinger
ryanorsinger / high-low.js
Created October 23, 2014 07:44
High Low Game with small functions
// 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);
}
@ryanorsinger
ryanorsinger / designer.html
Created December 11, 2014 01:21
designer
<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 {
@ryanorsinger
ryanorsinger / profiles.json
Last active October 11, 2018 19:52
JSON Profiles Exercise File
[
{
"_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",
@ryanorsinger
ryanorsinger / profiles_json.html
Last active August 29, 2015 14:15
Profile JSON Exercise
<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
@ryanorsinger
ryanorsinger / simple-simon.html
Created February 28, 2015 21:29
Simple Simon
<!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;
@ryanorsinger
ryanorsinger / todo.txt
Created March 12, 2015 20:29
TodoList Template
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.
@ryanorsinger
ryanorsinger / report.txt
Last active January 23, 2016 00:33
Example Sales Report to practice parsing
// 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
# Why is this change necessary?
# How does it address the issue?
# What side effects does this change have?
# Other comments
@ryanorsinger
ryanorsinger / laravel-setup.txt
Created May 11, 2015 19:38
First Steps after installing Laravel
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: