Skip to content

Instantly share code, notes, and snippets.

@rebdev
rebdev / wordpress-accordion-menu-variation.js
Last active December 8, 2015 07:04
Variation on a WordPress accordion menu
/*
* Variation on a WordPress accordion menu from the tutorial at http://cssmenumaker.com/blog/wordpress-accordion-menu-tutorial
* but
* a) with parent menu item links no longer removed when clicked, and
* b) with active items' immediate submenues and parents open by default.
*
* Original tutorial version by Russell Martin. Variations by Rebecca Appleton.
*
* NB: Tutorial URL above has other files downloadable that are required along with this one for this to work.
*/
@rebdev
rebdev / gulpfile.js
Created September 28, 2015 02:57
Gulpfile
// Include gulp (as installed locally and recorded in local package.json file)
var gulp = require('gulp');
// Include plugins (ditto)
var compass = require('gulp-compass'),
rails generate scaffold question title body:text
*** LOCAL GEMS ***
bundler (1.1.4 ruby)
rake (0.9.2)
Rebecca-Appletons-MacBook-Air:rails_projects rebecca$
@rebdev
rebdev / gist:2853109
Created June 1, 2012 15:51
Not so great...
# Exercises - write two methods in the book class that make the failing tests pass
# Extra Credit - refactor the way page_count is handled so it is more DRY
# Extra Extra Credit - add a humanize method to the String class so you can take a string like this:
# 'page_count' and turn it into this 'page count'
# Be sure to add tests for your extra credit!!
class Book
attr_accessor :title, :author, :page_count, :pages
@rebdev
rebdev / gist:2850037
Created June 1, 2012 07:45
NB: The "shape" attribute test is failing. Can't work out why, would love to find out the cause of the problem.
# Assignment: Fill in this Table class so the tests pass!
# Exercise Details:
#- Make a Table object class
#- Define at least 5 properties of a Table (legs, material, items_on_it, etc…)
#- Define an initialize method that sets one or more of the attributes when you call Table.new
#- Define a pretty_print method that prints out some useful information about your table
#- Email us a link to your code in a Gist
# Extra Credit:
<nav id="access" role="navigation">
<div class="container">
<div class="content">
<ul id="primary-menu" class="sf-menu sf-js-enabled sf-shadow"><li id="menu-item-117" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-117"><a title="Home" href="/"><img src="/wp-content/themes/swagger/assets/images/home-ffffff.png" style="width: border-size: 1px"></a></li>
<li id="menu-item-115" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-115"><a title="Rails fundamentals workshop" href="http://live.readysetrails.com/signup/">Rails Fundamentals Workshop</a></li>
<li id="menu-item-431" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-431"><a href="http://www.readysetrails.com/index.php/pairing-as-a-service/">Pairing as a Service</a></li>
<li id="menu-item-731" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-731"><a href="http://www.readysetrails.com/index.php/how-to-learn-ruby-on-
<div id="header_content">
<div class="container">
<div class="inner">
<div class="header_logo">
<a href="http://www.readysetrails.com" title="Ready Set Rails" class="tb-image-logo"><img src="http://dvdsbge8erttd.cloudfront.net/wp-content/uploads/rsr_logo-520x100.png" alt="Ready Set Rails"></a> </div><!-- .tbc_header_logo (end) -->
<div class="social-media">
</div><!-- .social-media (end) -->
<div class="clear"></div>
</div><!-- .inner (end) -->
</div><!-- .container (end) -->
Pick jacket up off chair.
Unzip the zipper.
Locate the opening of the left sleeve at the shoulder.
Put your left hand at that opening and thrust it through to the opening at the other end until the hand is free of the cuff.
Pull jacket around the back of you.
Do the same thing on the other side!
Do up the zipper.
Using computer/Ruby terms – arrays, strings, etc, rather than the ‘sights used to line up a target’ metaphor they used in the exercise - what is happening when we type “poem[‘toast’] = ‘honeydew’” and the word ‘honeydew’ is substituted for the first occurrence of ‘toast’ in the poem? Or is this no relation to arrays and the fact that they both use square brackets just coincidence?
We use the same thing later: Dir[‘/*.txt’]… is it a method? What can it be used on?
===============
What is going on here?
books.values.each { |rate| ratings[rate] += 1 }