Skip to content

Instantly share code, notes, and snippets.

@ksk5280
ksk5280 / require-1511.markdown
Last active May 17, 2016 04:59 — forked from rrgayhart/require-1511.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?
  • It's the fundamental Node building block, which is related to a single file. Anything within the module is private.
**Step One**: Watch [Sorting Algorithms in JavaScript](https://www.youtube.com/watch?v=uRyqlhjXYQI)
**Step Two**: Fork this gist.
**Step Three**: Respond to this question in your fork: "What are some of the balances and trade offs between different sorting algoritms?"
Bubble sort is very slow. It's mostly used for instructional purposes to show as a comparison to the other sorting methods.
Insertion sort is simple and doesn't require using a lot of space, so it can be a good algorithm to use if there's a limit in how much memory you have. It's relatively fast for a small amount of data.
Merge sort is fast but requires more memory than insertion sort, which you might not have.
Cheat Sheet:
http://vim.rtorr.com/ (START with this one)
http://www.catswhocode.com/blog/130-essential-vim-commands
Vim Adventure: vim game to help you with navigation.
http://vim-adventures.com/
Vim Golf: check your keystroke count. It's the exercism of vim.
http://www.vimgolf.com/
@ksk5280
ksk5280 / running_in_production_locally.markdown
Last active April 20, 2016 19:19
How to run apps in production locally
  • RAILS_ENV=production rails s
    • this sets the key in the ENV hash
    • you can also set these in different lines
  • Go to "http://localhost:3000/" and you'll see this:
    • Missing secret_token and secret_key_base for 'production' environment, set these values in config/secrets.yml
  • Run rake secret in terminal to generate a key
  • RAILS_ENV=production rake db:{create,migrate}
  • Delete username and password lines from database.yml under production
  • bundle exec rake assets:precompile
  • bundle exec rake assets:clobber
@ksk5280
ksk5280 / the_future_of_food.md
Last active April 13, 2016 03:55
The Future of Food Lightning Talk
  • Some issues with the current state of agriculture
    • Food transportation - negative environmental impact
    • Growing produce depends on good weather and uses lots of water
    • Pesticides
    • Lack of people wanting to farm
  • Discuss MIT Media Lab's Digital Farm, food computers, servers and data centers
    • Everything can be controlled: climate, water, nutrients, etc.
    • Data can be analyzed to see how to adjust the environment to improve the harvest
    • You can experiment with flavors based on the environment
  • Discuss benefits of digital computers

Project workflow:

  1. Load/Reload waffle.
  2. Choose a card from the backlog in waffle. If we're working separately, it's best to move that card that you've chosen into ready and perhaps assign it to yourself as well.
  3. git checkout master
  4. git pull origin master
  5. run rspec
  6. Checkout a new branch and tag it with #issue_number
  7. Write the feature test associated with your waffle card.
  8. Run rspec, and make sure that there are no errors that blow up the stack (missing ends, forgetting capitalization, etc.)
  9. commit your feature test

Setting Group Expectations

Group Member Names:

  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?

  2. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?

  3. Which feature(s) does each group member want to work on? Which feature(s) does each group member not want to work on?

* Describe one-to-one, one-to-many, and many-to-many database relationships
* one-to-one = a person has a SSN
* one-to-many => the US has many states, the states belong to one country,
* many-to-many => a child has multiple parents, the parent has many children. a person can attend many events
* Explain the difference between dev, test, and production environments in Rails
* In development Rails runs on local machine so you can see data
* Production mode is a public facing database
* The test mode is used in the tests and is wiped clean between test runs
* How do you create a Rails app from the command line with a postgres database?
* rails new appname --database=postgresql
@ksk5280
ksk5280 / cfu_crud_in_sinatra.markdown
Last active February 3, 2016 20:15 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD. Four main functions a user can use to manipulate data: Create, Read, Update, Delete
  2. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for. Using the Task Manager example:
    1. "/tasks", GET: shows all tasks
    2. "/tasks/:id", GET: shows one task
    3. "/tasks/new", GET: shows form to create a new task
    4. "/tasks", POST: creates a new task
    5. "/tasks/:id/edit", GET: shows form to edit a task
  1. "/tasks/:id", PUT: submit form to update existing task
class ServerManager
attr_reader :path, :thread, :pid
def initialize(path)
@path = path
end
def run
return if running?
@pid = Process.spawn "ruby", path