Skip to content

Instantly share code, notes, and snippets.

class ImportAirports
require 'csv'
def self.execute(csv_path)
CSV.foreach(csv_path) do |row|
airport = Airport.new
airport.ident = row[1]
airport.type = row[2]
airport.name = row[3]
airport.latitude_deg = row[4]
airport.longitude_deg = row[5]
@johnsonch
johnsonch / airports.coffee
Created November 13, 2014 04:43
airport demo app, ajax get weather report
getWeather = (url) ->
$("#results").html ""
if url
$.ajax
method: "get"
url: url
success: (data) ->
console.log data
console.log url
return
@johnsonch
johnsonch / getting-noticed.md
Last active August 29, 2015 14:14
Getting Noticed - For College Students

#Internships ##Getting Noticed in the Software Community full


#About me fit right

  • Chris Johnson
  • Software Engineer and Scrum Master at GettyImages
<html>
<head>
</head>
<body>
<?php
$error_messages = array();
array_push($errors, 'Some error');
array_push($errors, 'Another error');
array_push($errors, 'Wow this is bad');
?>
@johnsonch
johnsonch / fizzbuzz.php
Created March 3, 2015 21:11
for class fizzbuzz example
<?php
function generate_output($value){
if (is_fizz($value) && !is_buzz($value)){
return "fizz";
}
if (is_buzz($value) && !is_fizz($value)){
return "buzz";
}
@johnsonch
johnsonch / car.php
Created March 26, 2015 04:40
Simple PHP class example for class
class Car{
public $make;
public $model;
public function getMake(){
return $this->make;
}
public function setMake($input_make){
$this->make = $input_make;
@johnsonch
johnsonch / myclass.php
Created March 30, 2015 16:23
PHP getter and setter example for class
<?php
class myClass{
private $propertyA
private $propertyB
public function getPropertyA(){
return $this->propertyA;
}
public function setPropertyA($value){
@johnsonch
johnsonch / gist:2f9f65f5b06aaa55cad4
Created April 15, 2015 23:10
match_all_class_example.php
<?php
$string = 'My lovely gloves are lost in the clover, Love.';
$result = preg_match_all('/(\w*lo\w*)/i', $string, $matches);
if ($result == true) {
print "Found $result matches<br />";
}
else {
print 'Didn\'t find a match<br />';
}
$match_results = $matches[0];
@johnsonch
johnsonch / generate_fake.rake
Created April 16, 2015 18:34
Custom rake tasks for class example
namespace :generate_data do
desc "generate some test categories"
task :categories => :environment do
25.times do
Category.create(:name => Faker::Commerce.department)
end
end
desc "generate some test users"
task :users => :environment do
@johnsonch
johnsonch / show.html.erb
Created April 16, 2015 19:01
Wolfie's List - Show page markup for week 12
<div class="col-lg-4">
<p id="notice"><%= notice %></p>
<p>
<strong>Title:</strong>
<%= @ad.title %>
</p>
<p>
<strong>Description:</strong>