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
<html>
<head>
<title>CodeUp.dev</title>
</head>
<body>
<div style="text-align:center;margin:50px;">
<img style="float:none;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAABSCAMAAABdX6lFAAAAjVBMVEUAAABPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDF3nUlPXDFlfz5ujkN3nUlPXDF3nUlPXDF3nUlPXDFSYDNUZDRXaDZZbDdccDlheDxjfT1mgT9riUJwkUVylUZ1mUh3nUksu0oxAAAAIXRSTlMAEBAgIDAwQEBQUGBgcHCAgI+Pn5+vr7+/z8/Pz9/f7+/AFcCyAAAFtElEQVR42u2bfd+bJhSGFYkxRo0xRsnmC3bt3rr6/T/erA/NQQ5IXNZnK7/cfyVyJF5wC8gx3g+tbHxEf6SeK2oe4f384eYKL32E98vHYQjgHPcd/dswDK54uhrt+nOY5IinyWjXXx8mXlc8nYx2fRpmpU45umNG/TS86eaUo0NzTDAIBQ45ulsLugng1CFHF2tBqQC+Ou5o7GnfbUdjTx/ddjTo5IynOTh6TTtXPB3blpQXEdg64unStqTsReDZEU9z65JyhzztsKN/nwDPyNPuOvrzMKlFnnbW0V9+mfiQp3t3Hf3rDIg8ffiBgRO2op9nPOzpi/e9FUaTQu+95c944On9u3majZOY9+66DktP9+BpN4GPiqcv4GkXgbGnD+BpJ4HB0ynytJPA4Okb8rSbwODpAHnaTWCvNnh65ypwavD02VXgwODp1k1gvB+9g4nKTWDwNHwDT7sFjD3t18NdrXPA2NP7XnzEE1OUl2xSlceeTiTO34ojXAZVVFNIkZAV4DAr2KQiC5+cbY/netLp4K/lWM6DpFoKTaoRxEuK
<?php
$i = 99;
while ($i >= 0) {
$j = $i - 1;
echo "$i bottles of beer on the wall. $i bottles of beer!\n";
echo "We take one down and pass it around, $j bottles of beer on the wall!" . PHP_EOL;
$i -= 1;
if ($i == 2) {
@ryanorsinger
ryanorsinger / jQueryIDSelector
Created September 29, 2014 17:47
jQuery selectors - id, class, and element selectors. Method chainingl
<html>
<head>
<title>Exampe jQuery Page</title>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<h1 id="codeup">Hello Codeup</h1>
<ul class="codeup">
<li>$ is an alias of `jQuery` to reference the jQuery object.</li>
<li>JS natively has `window.onload = function() { console.log('The page has finished loading');`</li>
@ryanorsinger
ryanorsinger / whack step 1
Last active August 29, 2015 14:07
Whack-a-mole intro
<html>
<head>
<title>Whack A Mole</title>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<style>
#game-board {
width: 700;
margin: left;
@ryanorsinger
ryanorsinger / routes.php
Created October 9, 2014 13:16
routes and controller
<?php
class HomeController extends BaseController {
/*
|--------------------------------------------------------------------------
| Default Home Controller
|--------------------------------------------------------------------------
|
| You may wish to use controllers instead of, or in addition to, Closure
<p>Please input a number between 1 and 10:</p>
<input id="numb" type="text">
<button type="button" onclick="myFunction()">Submit</button>
<p id="demo"></p>
<script id="jsbin-javascript">
function myFunction() {
var x, text;
@ryanorsinger
ryanorsinger / Search field
Created October 14, 2014 19:52
Search field
{{ Form::open(array('action' => array('PostsController@index'), 'class' => 'form-horizontal', 'method' => 'GET')) }}
{{ Form::text('search', null) }}
{{ Form::submit('Search') }}
{{ Form:: close() }}
@ryanorsinger
ryanorsinger / PostsController@index
Created October 14, 2014 20:08
query, search, and pagination in PostsController@index
public function index()
{
$search = Input::get('search');
$query = Post::orderBy('created_at', 'desc');
if (is_null($search)) {
$posts = $query->paginate(3);
} else {
$posts = $query->where('title', 'LIKE', "%{$search}%")
bootstrap/start.php
Replace this onto line 27.
$env = $app->detectEnvironment(function()
{
if (!empty($_SERVER['LARAVEL_ENV'])) {
return $_SERVER['LARAVEL_ENV'];
}
@ryanorsinger
ryanorsinger / PostsController@store
Created October 15, 2014 16:51
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();