Skip to content

Instantly share code, notes, and snippets.

View davemaurer's full-sized avatar

Dave Maurer davemaurer

View GitHub Profile
@davemaurer
davemaurer / blank_page_strategies.md
Created February 3, 2017 18:57
Techniques to combat blank page syndrome in Ruby

Step One - Lay out all your legos

Read all of your requirements (the entire assignment, project, etc.) and on a piece of paper or whiteboard, write down all of the parts/pieces.

Step Two - Pick the right tool for the right job

When deciding the overall structure of your program, there are really only four types of tool you will be using most of the time. Those are: 1. Classes, 2. Methods, 3. Variables, 4. Modules. Modules are not needed at all to write a Ruby program, but they are a good tool to use to organize your code better, and something to get familiar with once you have the basics down (Class,

@davemaurer
davemaurer / examples.md
Last active November 27, 2016 19:08
Examples of things in Ruby

LOCAL variable assignment:

assigning an integer to a variable named x

   x = 5 

assigning a string to a variable named name

   name = 'Bill'
@davemaurer
davemaurer / ruby_intro.md
Last active February 6, 2017 18:34
Introduction to Ruby and Programming

Ruby

It's dynamic: You can change objects and variables after they have been set.

It's interpreted: Most of the execution in Ruby happens on the fly as it reads the code. As opposed to a compiled language that first checks to see that everything is in order before it starts executing. Your Ruby program can work halfway then error out, while a compiled language will fail to start running at all.

It's object oriented: Code in Ruby is meant to be compartmentalized, so you can easily shift pieces around, and the code contained inside of an object is able to change the object into something different. This gives each object a sense of "self". Some of the OO characteristics of Ruby are the idea of Classes, instance variables, value abstraction, inheritance, etc. More on this

@davemaurer
davemaurer / programming-terms-ruby-and-more
Created October 22, 2016 20:33
Common terms in programming, and Ruby
1. Browser(Web browser): A software program that lives natively on your computer, handling sending http requests, and receiving
http responses. examples: Chrome, Firefox, Brave.
2. Native program: A piece of software that has been developed for use on a particular device or platform. All code it needs to
run is stored locally on the computer/device using it. An internet connection is not always needed as data can also be
stored locally, but does not always have to be.
3. Programming Language: A set of rules for creating, managing, storing, and outputting data. Programming languages provide
the logic building data constructs, which can then be accessed. Sometimes they provide everything needed to produce
code on a web page (JavaScript) and sometimes they use other tools to do this (Rails is a web framework that uses the Ruby
language to produce web applications.)
4. Client: Software or hardware that is responsible for sending requests and processing responses over the internet. A web
@davemaurer
davemaurer / sample.js
Created December 16, 2015 19:40 — forked from biglovisa/sample.js
react sample code
///// index.js
import React from 'react';
import ReactDOM from 'react-dom';
import HelloWorld from './HelloWorld';
ReactDOM.render(<HelloWorld name='Meeka' />, document.getElementById('container'));
///// HelloWorld.js
@davemaurer
davemaurer / react-notes.md
Created December 16, 2015 17:27 — forked from biglovisa/react-notes.md
React in theory
@davemaurer
davemaurer / countdown-recursive
Created December 15, 2015 18:50
snowday-javascript-exercises
function countdown(number) {
if (number >= 0) {
console.log(number);
return countdown(number - 1); // decrement number each time you recur countdown until the conditional is satisfied
}
}
countdown(10);

Step One: Watch Mary Rose Cook Live Codes Space Invaders from Front-Trends. (The second worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: What is one approach you can take from this Mary's code and implement in your project?

I like how she used window.onload. That's cool. Her collision detection will also come in handy for our game, as tomatoes need to know when they splat against our face. Her tick function also seems like somthing we can use. A center property combined with a size property will probably help us to track where our face is, rather than tracking an x and y. Keyboarder is pretty sweet also. We would like sound with our game also, so her sound functions look appealing. Basically, almost everything she uses seems like it could apply to our game, sans the patrol and shooting.

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded). Respond below with your thoughts. Did any of the responsibilities that she lists surprise you? Do you feel like you mentally split your client side code in IdeaBox and other past projects into these responsibilities? It surprised me that interaction and data/server communication were separated at first. Once she gave me a visual aid it was easier to see the delineation. I will try to write code keeping these responsibilities in mind in the future in order to stay more organized and be able to better model the client side of the apps I write. I would have liked the talk to be solely focused on the four categories (as she calls them) with use cases

**Step One**: Watch [Sorting Algorithms in JavaScript](https://www.youtube.com/watch?v=uRyqlhjXYQI)
**Step Two**: Fork this gist.
**Step Three**: Respond to this question in your fork: "What are some of the balances and trade offs between different sorting algoritms?"
When considering real world execution, a good sorting algorithm should be both stable and fast. Depending on your needs there are two widely used versions:
1. Insertion Sort: Traverses a collection, comparing elements to their closest next element and swaping if necessary.
Pros: stable, meaning it maintains relative order for elements with equal values.
easy to implement and low on resources