Skip to content

Instantly share code, notes, and snippets.

View keevie's full-sized avatar
🐤

Daniel Dyssegaard Kallick keevie

🐤
View GitHub Profile
'''
File: hw19_Kallick.py
Author: Daniel Dyssegaard Kallick
Description:counts word frequency
'''
def word_frequency(filename):
"""Takes a filename(string) as a parameter, returns a dictionary of
word frequencies"""
fin=open(filename,'r')
wordlist=fin.read().split()
def see(x):
return x[1]
Stein DONE
Nozick Bias DONE
Nozick Bundles DONE
Caplan 1 DONE
caplan 2 &4&mental illness
gore1 DONE
westen1 DONE
westen2 DONE
gore2 DO
Tea Partay DONE
def prime_factorization(num)
return [] if num == 1
2.upto(num - 1).each do |factor|
if num % factor == 0
return [factor] + prime_factorization(num / factor)
end
end
[num]
end
def fibs_sum(n)
return 1 if n == 1
return 2 if n == 2
fibs_sum(n - 1) + fibs_sum( n - 2) + 1
end
class CreatePeopleTable < ActiveRecord::Migration[5.0]
def change
create_table :people do |t|
t.string :name, null: false
t.integer :house_id, null: false
t.belongs_to :house
t.timestamps
end
end
create_table "people", force: :cascade do |t|
t.string "name", null: false
t.integer "house_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["house_id"], name: "index_people_on_house_id", using: :btree
end
"" For the plugins, first run the command below:
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" Then open vim and type:
set clipboard=unnamedplus
set t_Co=256
set updatetime=1000
set linebreak
set encoding=utf-8
set rtp+=$HOME/.vim/bundle/Vundle.vim
set incsearch
function fizzBuzz(array) {
let array_length = array.length;
let new_array = []
for (var i = 0; i < array_length; i++) {
if ( array[i] % 15 === 0 ) {
continue
} else if ( array[i] % 5 === 0 ) {
new_array.push(array[i])
} else if ( array[i] % 3 === 0 ) {
new_array.push(array[i])
~/a/facespace ❯❯❯ git stash list posts ✭ ═
stash@{0}: WIP on wall: 88570f8 much progress, still not quite working
stash@{1}: WIP on posts: 1b3063b begin the posts feature
stash@{2}: WIP on posts: 1b3063b begin the posts feature
stash@{3}: WIP on wall: 4ddb6d7 Merge branch 'master' into wall
stash@{4}: WIP on wall: 0c22f96 add profileurl column to database and validation to model
stash@{5}: WIP on errors: 9eb5988 add error popups and icons, not fully working yet
~/a/facespace ❯❯❯ git stash apply posts posts ✭ ═
'posts' is not a stash-like commit
~/a/facespace ❯❯❯ git stash apply 1