Skip to content

Instantly share code, notes, and snippets.

View mathildathompson's full-sized avatar

mathilda thompson mathildathompson

View GitHub Profile
##Dependencies
#If you want to require library c when you install it it requires library d;
#Things you are depending on depend on other things;
##PACKAGE MANAGER SOLVES ALL OF THIS!
gem install package name #Will work out where to store it on your system, it will work out all the dependencies and go and download them;
#Some gems are very complicated such as ImageMagick, it depends on software that is written on your computer and not in ruby;
require 'sinatra' #only works if we have installed sinatra on our machine;

Point Mutations

A mutation is simply a mistake that occurs during the creation or copying of a nucleic acid, in particular DNA. Because nucleic acids are vital to cellular functions, mutations tend to cause a ripple effect throughout the cell. Although mutations are technically mistakes, a very rare mutation may equip the cell with a beneficial attribute. In fact, the macro effects of evolution are attributable by the accumulated result of beneficial microscopic mutations over many generations.

The simplest and most common type of nucleic acid mutation is a point mutation, which replaces one base with another at a single nucleotide.

By counting the number of differences between two homologous DNA strands taken from different genomes with a common ancestor, we get a measure of the minimum number of point mutations that could have occurred on the evolutionary path between the two strands.

This is called the 'Hamming distance'

##RAILS
#The router works out which controller to talk to;
#The controller talks to the models, the models talk to the views;
#One file shows you all of the different routes in your programme;
##To get into you bash profile
subl ~/.bash_profile #Goes into your bash_terminal;
echo $PATH #Shows your path;
rails new projectname -d postgresql #1) creates a new poject using postgres by default;
#2) Database.yml file, change the username and delete production and test databases;
rake db:create #3) Create the database
rails is for high level stuff and rake is for tasks within your rails app;
#The column name in the database is the attribute in the model;
#Have 4 tabs running: bash, rails server, rails console, psql
\c to connect to database in psql;
rake db:create #connects to psql to connect to the database;
rails g migration create_artists #create an empty migration file;
rails g migration create_artists name:string nationality:string #will write the table for you;
#The filename and he class name in the migrations have to be the same, DONT MESS WITH THEM;
#You do not need to mention ids when you create a table rails will automaticlly do this for you;
rake db:migrate #This will run the most recent migration that it has not run for you; #You can check the schema.rb to check that the migration has been run;

1`# Anagram Detector

Write a program that, given a word and a list of possible anagrams, selects the correct one(s).

In other words, given: "listen" and %w(enlists google inlets banana) the program should return "inlets".

Source

Inspired by the Extreme Startup game.

rails g migration create ingredient_recipes
#In a join table we want it not to create an id, it only needs 2 columns;
create table :ingredicnets_recipes, :id => false
\d ingredients_recipes
# The resources should be plural at all times; #If you make a get request to '/' recipes it should show you all the recipes;
rm app/views/*/create.html.erb #delete from any folers inside views
#Make sure the postgres App is running on computer
#Carrierwave works with ORM such as Active Record and Datamapper;
rails new carrier_wave_app -d postgresql
add production and development database to database.yml #make sure you do not add one of the fields to production
rails g scaffold art_galleries name:string location:string avatar:text #Also create the table in migrations folder;
#Is it added to the protected attributes method in the controller;
#Add root_to in the config.routes;
gem 'carrierwave'
rails generate uploader Avatar #Give you a class in app/uploaders/avatar_uploader.rb
rails g migration add_avatar_to_art_galleries avatar:string
rails new emails -d postgresql
rails generate mailer UserMailer
rails generate scaffold user name email
rake db:create
rake db:migrate
initializers/setup_mail.rb or config environments development.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
##BOOTSTRAP
#Sass bootstrap when import into CSS ass a dot before css
#Also add the JS into the tree of application.js
##DEVELOPMENT
##TEST
##PRODUCTION
#Once you push it up to production the CSS and JS files are compressed, all of the white space and comments are taken out;