Skip to content

Instantly share code, notes, and snippets.

Damian Mastylo dmastylo

View GitHub Profile
View .vimrc
```set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() " alternatively, pass a path where Vundle should install plugins "
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
View gist:7ef673ddc2bd1a903cc3
# /config/application.rb
module RailsApp
class Application < Rails::Application
config.autoload_paths += Dir["#{config.root}/lib/**/"]
config.autoload_paths += Dir["#{config.root}/app/jobs/**/"]
config.autoload_paths += Dir["#{config.root}/app/workers/**/"]
config.autoload_paths += Dir["#{config.root}/app/services/**/"]
end
end
@dmastylo
dmastylo / double_nest.rb
Last active Aug 29, 2015
Getting results from a doubly nested relationships that has a count of > 0
View double_nest.rb
class Category < ActiveRecord::Base
# Relationships
# ========================================================
has_many :shops
end
class Shop < ActiveRecord::Base
# Relationships
@dmastylo
dmastylo / rev_with_foldr.scm
Created Apr 7, 2014
Reverse a list with foldr
View rev_with_foldr.scm
(define (rev l)
(foldr (lambda (n list) (append list (cons n '()))) l '())
)
View test.scm
(define (func (lambda (n cnt)
(if (= n 1)
cnt
((func (quotient (+ n 1) 2) (+ 1 cnt)))
)
)
View simple_stack.scm
(define (addToStack expr extra_arg)
(cons expr extra_arg)
)
(define (popStack extra_arg)
(cond ( (null? (car extra_arg)) '() )
( else (cdr extra_arg) )
)
)
View sumList.scm
(define (sumList x)
(if (null? x) 0)
(else (+ (car x) (sumList (cdr x)))
)
)
View parser.prolog
% Representation of grammar. Nonterminals expr, term, term_tail,
% and factor_tail are represented as non(e, _), non(t, _), non(tt, _),
% and non(ft, _), respectively. Special nonterminal start is encoded
% as non(s, _).
% Terminals num, -, and * are represented by term(num,_), term(minus,_)
% and term(times, _). Special terminal term(eps, _) denotes the epsilon
% symbol.
%
% Productions are represented with prod(N, [H | T]) --- that is, arguments
% are the production index N and a list [H | T] where the head of the
View econ_notes.txt
Po = D / (1 + required return) + P1 / (1 + required return)
Po = D * (1 + constant growth) / (required return - constant growth)
EM = 1 / ratio of ROE to ROA
ROE = ROA * EM
req reserve + excess res + loans + t bill = deposits + capital
req reserve = deposit * ratio
gap analysis => i rate * (rate sensitive assets - rate sensitive liability)
raise in interest ^ asset return, V liability
^ money supply, ^ stock price, do not buy
investors acting on best info in 90's -> 2001 bubble
You can’t perform that action at this time.