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

Reading a CSV file and parsing the results

Topics

  • Reading files
  • Iterating across a map of keys and values
  • Parsing results

Setup

  • Download a copy of the states.csv file into your exercises/project directory of your choice.
  • Use the programming language of your choice to solve the following problems.
@ryanorsinger
ryanorsinger / gist:3607475a1a0925a67b98
Created June 2, 2015 19:49
Setting up a new Laravel installation and new ansible site
Step 1.
`vagrant ssh` to ssh into your Vagrant VM.
from `/vagrant/sites/` run `composer create-project laravel/laravel {directory} 4.2 --prefer-dist`
name `{directory}` project.dev or mynewsite.dev.
Step 2.
from your `~/vagrant-lamp/` directory on your Mac, run `ansible-playbook ansible/create-vagrant-site.yml`
name the new site exactly as you've named project.dev or mynewsite.dev
@ryanorsinger
ryanorsinger / my_get_form.php
Last active August 29, 2015 14:22
Intro to forms - using GET and the query string
<?php var_dump($_GET); ?>
<?php var_dump($_POST); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My First Form</title>
</head>
@ryanorsinger
ryanorsinger / ajax_blog.html
Created July 1, 2015 15:21
Ajax Blog Example
<html>
<head>
<title>AJAX Blog</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" type="text/css" href="/css/darkly.css">
@ryanorsinger
ryanorsinger / forms_practice.txt
Last active September 24, 2015 04:18
Forms Practice - make these forms for your own HTML library
Pages:
-
- resume page
-
-
Forms:
Search form
- method="GET"
- must have a label
@ryanorsinger
ryanorsinger / pages.md
Last active October 30, 2015 18:28
github pages

Host your front-end files!

Step 1: Configure a new site.dev on your Vagrant box

  • From the ~/vagrant-lamp/ directory on your Mac
    • Run ansible-playbook ansible/playbooks/vagrant/site/static.yml
    • Name the site your-github-username.dev` with your GitHub user name.
    • Copy any .html files you want to host into ~/vagrant-lamp/sites/your-github-username.dev/public
    • Create folders for assets like css, js, img. Populate them as necessary.

Step 2: Setup your GitHub Pages repo

@ryanorsinger
ryanorsinger / readingURLs.md
Last active March 8, 2016 02:34
Browser's Query String and $_GET

Query Strings

In PHP, the $_GET SUPERGLOBAL is an associative array (available anywhere since it's a SUPERGLOBAL) that represents all the key => value pairs contained in the URL's Query String. The URL's query string represents a set of arbitrary key=value pairs that are a critical part fo the interface for your web applications.

Copy and paste this code to the top of your PHP script to see the $_GET array in relation to the Query String after the ? character:

// $_GET is PHP's globally accessible variable that contains any additional key=>value pairs sent with an HTTP GET request from a client
echo "The \$_GET SUPERGLOBAL is: ";
var_dump($_GET);
@ryanorsinger
ryanorsinger / Automobile.php
Last active March 10, 2016 16:40
Automobile Class/Object Example
<?php
class Automobile
{
public $make;
public $model;
public $color;
public $miles;
@ryanorsinger
ryanorsinger / gist:3bfa2f52812515c6a669
Created March 10, 2016 16:43
Coding Challenge Programming Problems
Coding Challenges. Complete these in the language of your choice.
1. Count the number of Fibonacci numbers in given range. First few Fibonacci
numbers
are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 141, ..
Range is 10 to 100
@ryanorsinger
ryanorsinger / gist:745a84104205752986c23aa5a83ce5be
Created June 24, 2016 21:31
nested conditional conditional conditions
<?php
switch($projectStatus) {
case 'Payment Received':
if(Input::get('invoice_approval_date') == ''
&& Input::get('project_submitted_date') == ''
&& Input::get('invoice_submitted_date') == ''
&& Input::get('payment_received') == '') {
$project->payment_received = 'Today';
$project->invoice_approval_date = 'Today';