I'm putting together the curriculum for a Code Ramp 102 class, which comes after 101 - an Intro to Web Development class I taught earlier in the year for Success Center SF. SCSF is a non-profit dedicated to helping underserved youth in the San Francisco community.
By the end of 101 students will have learned:
- How the web works
- HTML structure, attributes
- CSS structure, properties (common ones), layout, bootstrap
- JS variables, functions, control flow, event handling, callbacks, DOM manipulation
components.petition_manage.guides.part_one | |
components.petition_manage.guides.part_two | |
components.petition_manage.guides.part_three | |
components.petition_manage.guides.part_four | |
components.petition_manage.guides.part_five | |
components.petition_manage.guides.part_six | |
components.petition_manage.guides.part_seven | |
components.petition_manage.guides.part_eight | |
components.petition_manage.guides.part_nine | |
components.petition_manage.guides.part_ten |
components.petition_manage.guides.part_ | |
components.petition_manage.guides.part_ | |
components.petition_manage.guides.part_ | |
components.petition_manage.guides.part_eleven |
So far, our users#show
action pulls down both a User
model and a Repos
collection for that model. If we were to navigate from users#index
to users#show
, we already have that user model cached in memory (because we fetched it in order to render the list), but we have to make a roundtrip to the server to fetch the Repos
, which aren't part of the User
attributes. This means that instead of immediately rendering the users/show
view, we wait for the Repos
API call to finish. But what if instead we want to lazy-load the Repos
so we can render that view immediately for a better user experience?
We can achieve this by lazy-loading models or collections in our subviews. Check out the users#show_lazy
action, which demonstrates this approach:
// app/controllers/users_controller.js
module.exports = {
// ...
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
export PS1=' | |
λ \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ ' |
Put this in your new bookmark "link": | |
javascript:document.body.appendChild(document.getElementsByName('issue[body]')[0].value="* description: \n* suggested assignee: @\n* environment:\n* expected behavior: \n* occurrence: %\n* browser: chrome, firefox, safari\n* steps to reproduce:\n 1)\n 2)\n 3)\n* screenshot:\n* console log:") |
var spawn = require('child_process').spawn, | |
cs = spawn('/Users/mattpardee/Work/test/node_modules/coffee-script/bin/coffee', []); | |
cs.stdout.on('data', function (data) { | |
console.log('stdout: ' + data); | |
setInterval(function() { | |
console.log(cs.stdin.bytesWritten, cs.stdout.bytesRead); | |
cs.stdin.write('number = 42\n'); | |
}, 1000); | |
}); |