This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- HTMLTrace:Start sites/vacancies/_dam_link_rdfa.rhtml --> | |
| <% | |
| return unless file = dam_link_rdfa.downloadable_application_form | |
| return unless file_name = file.file_name | |
| if file_found?(file) | |
| file_name_for_link = case file_name | |
| when /\.pdf$/i then "Downloadable Form (PDF)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %%%6. Define a predicate list_of_divisors(N,L) which for a positive integer N | |
| %%% calculates the list of its proper divisors. (A proper divisor of n is a positive | |
| %%% integer m < n such that m divides n.) | |
| divisor(N,P) :- | |
| P>0, | |
| N>P, | |
| 0 is N mod P. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Widgets::GeneralHelper | |
| def stylesheets_include(options = {}) | |
| set_minify | |
| default_options = {:stylesheets => "all", :blueprint => false, :site_code => false, :ie => false} | |
| stylesheets_options = default_options.merge(options) | |
| raise Dir["#{Rails.root}/public/sites/#{site.site_code}/css/*"].to_yaml | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set :site_path, Proc.new { Capistrano::CLI.ui.ask "Site to export (e.g. 'all', 'JGP' etc.): " } | |
| # we don't want exporting all sites if nothing is provided | |
| # that would be a costly mistake... | |
| raise ArgumentError, "Site path must be specified" if site_path == "" | |
| # site_path here is whatever we specify, 'JGP' for example | |
| # if 'all' was provided, reset site_path to .../sites/ | |
| site_path = "" if site_path == "all" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # each approach | |
| locations = [] | |
| stocks.each {|stock| locations << stock.location} | |
| return locations | |
| # refactored with inject | |
| stocks.inject([]) {|locations, stock| locations << stock.location} | |
| # the correct approach | |
| stocks.map {|stock| stock.location} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data Btree a = ND | Data a | Branch (Btree a) (Btree a) | |
| deriving (Show,Eq) | |
| data Dir = L | R | |
| deriving (Show,Eq) | |
| type Path = [Dir] | |
| --- Part a) | |
NewerOlder