Skip to content

Instantly share code, notes, and snippets.

View andersr's full-sized avatar
😅
Focusing

Anders Ramsay andersr

😅
Focusing
View GitHub Profile
@andersr
andersr / url_slug.rb
Created March 22, 2015 14:28
Generate URL slug
before_save :generate_title_slug
protected
def generate_title_slug
title_slug = self.title.downcase.strip.truncate(50)
#replace spaces with dashes
title_slug.gsub! " ", "-"
@andersr
andersr / disable_submit.coffee
Last active August 29, 2015 14:17
Disable submit unless all required fields have values
# disable submit unless all fields with .require_field class have values
$(document).ready ->
total_required_fields = 0
$( ".required_field" ).each ->
total_required_fields += 1
if $(this).val().trim().length == 0
@andersr
andersr / some_way_to_iteratively_reduce_code_distance.md
Created April 27, 2014 15:47
Some ways to iteratively reduce your code distance

##Some ways to iteratively reduce your code distance:

  • pair with developers
  • learn to write pseudo code
  • integrate live style guides into your practice
  • try designing and implementing a very small, very simple app (better yet, pair w someone doing it.)
@andersr
andersr / hr_pseudo_code_example.md
Last active August 29, 2015 14:00
HR Onboarding Pseudo Code Example

##The client's description of the problem

>A major challenge for us is adding new employees to our HR system, which is connected payroll, benefits, email, and many other internal system. Currently, this is a manaul process, involving the security staff, IT, and HR personnel. It’s very time-consuming and it leads to delays in new employees having access to internal tools. The main goal of the tool is to provide new employees with an Employee ID. After that, we need to use that ID to give them access based on their department, role, and level of seniority. For example, a VP of Engineering will get all kinds of admin-level access to a range of internal systems, while, say, a product manager, would likely only get access to email, the intranet, and a few other services. In order to provide the ID, we have to confirm their identity. This can be done using either the last four of their SSN, valid driver’s license number, or a valid passport number. We use an external service to confirm that this number match

##Code Distance Activity

  1. Grab a stickie.
  2. Write on your stickie what you see as your code distance.
  3. Place your stickie where you see yourself in relationship to actual code/working software.
  4. Let's hear some of your stories...

##What's Your Code Distance?

  • How removed you are (or not) from the production code in a project you currently are working on, OR...
  • Your general level of coding experience (eg "I know some HTML/CSS", "I use jquery for prototyping", "I work closely w devs but have no code experience.")
  • Other "distances" are also important, eg: Content Distance User Distance, Market Distance, Community Distance, but today we're focusing on code distance.
@andersr
andersr / redesign_conf_links.md
Last active August 29, 2015 14:00
RedesignConf Links
@andersr
andersr / pseudo_code_guidelines.md
Last active August 29, 2015 14:00
Pseudo Code Basics:

##Pseudo Code Basics: Everyone will have their own approach. This is mine...

  • Break a large problem (epic) down into smaller and smaller pieces.
  • Define major entities you're working with and attributes you currently know about.
  • Don’t try to figure out all the details up-front.
  • Pick one thing to explore in greater detail and break that down to atomic-level detail.
  • What is the default state?
  • What is a triggering event/input for the thing we're currently exploring?
  • Use small blocks of Boolean logic (IF ELSE AND OR) to express the atomic level design.
@andersr
andersr / convert_pseodo_code_to_test.rb
Last active August 29, 2015 14:00
Example of converting a pseudo code line into a test
describe "Cut two slices of bread and place on the plate" do
it "grasps the Knife in a cutting grasp" do {
#code that attempts to complete this task
#if it passes, it returns something to hte effect of "test passed"
#if it fails, it returns a message like "grasps the Knife in a cutting grasp" failed, for the following reasons, eg no 'No Knife was found'
}
# Grasp the bread-loaf and place it on the table, such that it is directly below the knife.
# Position the bread-loaf such that it is perpendicular to the cutting edge of the knife and move the bread-loaf laterally until only a half inch is below the knife.
@andersr
andersr / alien_sandwich_workshop.md
Last active August 29, 2015 14:00
Alien Sandwich Workshop

Drawing of Alien with materials for making a PBJ sandwich

#Explain to an Alien How to Make a Peanut Butter and Jelly Sandwich

  • An alien is positioned in front of a table.
  • On the table is a plate, a knife, a jar of jelly, a jar of peanut butter, and a loaf of bread.
  • The alien can read and recognize English and English grammar, but may not understand what specific words mean.

##Your assignment

  • Pair up
  • Together, create a list of instructions for making a peanut butter and jelly sandwich.