Skip to content

Instantly share code, notes, and snippets.

View tensiondriven's full-sized avatar
💭
We shape clay into a pot, but it is the emptiness inside that holds what we want

Jonathan Yankovich tensiondriven

💭
We shape clay into a pot, but it is the emptiness inside that holds what we want
View GitHub Profile
# gem install --version 1.3.0 sinatra
require 'pry'
gem 'sinatra', '1.3.0'
require 'sinatra'
require 'sinatra/reloader'
require 'sqlite3'
get '/users' do
db = SQLite3::Database.new "store.sqlite3"
What is the best methodologies to follow to debug (e.g. using binding pry, splitting complex functions into multiple steps to see where the code is breaking, etc)?
How do we apply TDD more effectively? The TDD example seemed more of a Ruby logic exercise than a TDD exercise.
What is a good strategy for setting up your html when you get a webpage design, i.e. how do we set up our divs, layouts, etc."
"What's the best workflow to use in Git? For smaller teams, and for larger teams? How does the team workflow tie into Github? This is especially important if we're going to start creating group projects.
How can we best utilize Git to keep version control under, well, control?

Homework for April 9th

  1. Write your first rails app
  • Create the Movies app using rails.
  • Start with the command:
    • rails new rails-movies
  1. Create your controller:
    • rails g controller movie
  1. Create ONE or TWO models, ie for movies and searches:
  • app/models/movie.rb - This is a class for a movie.
1. Draw a circle on a piece of paper.
2. Think about someone in your life that you respect, perhaps thinking about your more exotic friends on facebook who you seldom see, but respect deeply.
3. Draw 4" circle on a piece of 8.5x11 paper
4. Write their name at about 2 oclick from the circle. (You'll write up to 5 peoples names around the circle total.)
5. Think about someone else in your life that you respect in a similar way.
6. Write their name around the circle.
7. Think about the values they share. Try to come up with a single value or guiding force that you think these people share, that you respect.
8. Continue thinking about people and writing them down, up to 5.
9. As soon as you know the value these people share, write it in the circle.
10. Repeat for 2 other values that you hold near.
8:11 you write the names of people dear to you (and why) and you keep writing names of people and they extend outwards from the circle
8:11 at some point, you just draw a line and say "these people I'll spend more time with, the rest are distractions"
8:12 and sometimes that means cutting people out of your life
8:12 - time - is - finite -
struct test_struct
{
int val;
struct test_struct *next;
};
@tensiondriven
tensiondriven / gist:6546677
Last active December 22, 2015 23:29
/usr/local/etc/mongod.conf
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Append logs to /usr/local/var/log/mongodb/mongo.log
logpath = /usr/local/var/log/mongodb/mongo.log
logappend = true
# Only accept local connections
bind_ip = 127.0.0.1
@tensiondriven
tensiondriven / gist:6944426
Created October 12, 2013 01:10
Store a model in a Mongoid field using YAML
class YamlType
def mongoize
YAML.dump(object)
end
class << self
def mongoize(object)
YAML.dump(object)
<h1>Your browser is not supported</h1>
<p>To give our users the best experience, we only allow Chrome, Firefox and Safari.</p>
<p> Please download one of these browsers using the following links:</p>
<ul>
<li> <a href='http://google.com/chrome'>Download Chrome</a> (Preferred)
<li> <a href='http://www.apple.com/safari/'>Download Safari</a>
<li> <a href='http://www.mozilla.org/en-US/firefox/new/'>Download Firefox</a>
</ul>
def self.create_for_referral_viewed(referral)
first_or_create({
user: referral.opportunity.owner,
name: 'view',
actable: referral,
actor: referral.redeemed_by # may be nil, can't count on it being there
})
end
# Hey Jose - should first_or_create take some criteria? What criteria is this using?