Skip to content

Instantly share code, notes, and snippets.

View jasonpilz's full-sized avatar
💻

Jason Pilz jasonpilz

💻
View GitHub Profile

Setting Group Expectations

Group Member Names: Emily, Sekhar, Jason

  1. When are group members available to work together? What hours can each group member work individually? Are there any personal time commitments that need to be discussed?
  • Emily - not 4-6pm, avail 6-9pm, pref sat over sunday
  • Sekhar - anytime, FLEXIBLE!
  • Jason - weekdays flex to stay, pref sat over sunday
  1. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?
@jasonpilz
jasonpilz / running_production_locally.markdown
Created November 13, 2015 15:25
How to run your rails app in production locally
  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. Run rake secret and copy the output
  5. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  6. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  7. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.

Now that we have ruby, node, and rails, it is time to get pg

    ssh root@your_ip_address_for_DO
    sudo apt-get update
    mkdir -p ~/.rbenv/plugins
    cd ~/.rbenv/plugins
    git clone https://github.com/sstephenson/rbenv-vars.git
    cd
    sudo apt-get install postgresql postgresql-contrib libpq-dev
  • What's the total revenue for all items? SELECT SUM(revenue) FROM items;

  • What's the average revenue for all items? SELECT AVG(revenue) FROM items;

  • What's the minimum revenue for all items? SELECT MIN(revenue) FROM items;

  • What's the maximum revenue for all items?

@jasonpilz
jasonpilz / capybara cheat sheet
Created January 14, 2016 02:35 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

- Mission

The purpose of this tutorial is to mimic setting up a DigitalOcean/AWS EC2/Linode server. The main advantages of having a virtual machine is that you can learn without worry of breaking things.

The first lesson will be all about getting familiar with a headless machine and getting a language we all know and love (ruby). Then we can mess around and try things out purely in the terminal.

The only three good options for a text editor are: emacs, vi, and vim. We will be using vim but vi itself is great and comes by default on Ubuntu 12.04.

Now you can practice getting used to ssh'ing into headless machines, using terminal based text editors, and using a terminal based window/session manager (tmux). The reason we have to use vim and tmux is that there is no X environment in a headless machine (the GUI, graphics, pretty things, etc..). The main reason for this is to save space on precious costly SSD data.

Array Prototype Methods

I understand that functions in JavaScript can take any number of arguments.

  • yes

I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.

  • yes

Where are the methods available to all arrays (e.g. forEach, map, etc.) defined?

  • Array.prototype

JavaScript Functions

I can explain the difference between function declarations and function expressions.

I can explain what the value of this is in a normal function.

I can explain what the value of this is when called from the context of an object.

I can explain how to explicitly set the value of this in a function.

Reference To: Sorting Algorithms in JavaScript

**Respond to this question in your fork: "What are some of the balances and trade offs between different sorting algoritms?"

###COMPARISON:

Bubble Sort Insertion Sort Merge Sort
Pros Easy to Implement
Stable sort
Good if short on space
Stable sort
Fastest
Cons
Not Stable sort
Slow as eff
Not good for large data Need lots of resources to use
O(n) O(n2) O(n2) O(n log n)
@jasonpilz
jasonpilz / require.markdown
Last active February 9, 2016 20:38 — forked from rrgayhart/require.markdown
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

In the context of Node, what is a module?
  • a module maps, or corresponds to, a file.