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 / 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 / redesign_conf_links.md
Last active August 29, 2015 14:00
RedesignConf Links

##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.

##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...
@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

@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 / 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 / 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 / generate_token_id.rb
Created March 22, 2015 14:31
Generate token id
before_save :generate_token_id
def to_param
token_id
end
protected
def generate_token_id
begin
@andersr
andersr / crackle_pop.rb
Last active August 29, 2015 14:27
A program that prints out the numbers 1 to 100 (inclusive). If the number is divisible by 3, print Crackle instead of the number. If it's divisible by 5, print Pop. If it's divisible by both 3 and 5, print CracklePop.
(1..100).each do |number|
if (number % 3 == 0) && (number % 5 == 0)
puts "CracklePop"
elsif number % 3 == 0
puts "Crackle"
elsif number % 5 == 0
puts "Pop"
else
puts number