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
| SELECT AVG(i.total), MAX(i.total) | |
| FROM( | |
| SELECT COALESCE(SUM(a.count) + SUM(b.count), 0) as total | |
| FROM users | |
| LEFT JOIN ( | |
| SELECT | |
| COUNT(*) as count, | |
| user_id | |
| FROM "quick_answers" | |
| GROUP BY user_id |
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
| parameters | |
| : | |
| parameter (',' parameter)* | |
| ; | |
| parameter | |
| : | |
| 'var' ID | |
| ; |
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
| xs = %w{1 0 2 0 3 1 0 1 2 0} | |
| ts = %w{16 9 17 12 22 13 8 15 19 11} | |
| y = lambda {|x| 10.2 + 4.0 * x.to_f} | |
| res = xs.each_with_index.map do |x, index| | |
| (ts[index].to_i - y.call(x))**2 | |
| end.inject(:+) | |
| puts res |
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
| Node: (500|268) { bestI: 2, bestS: 127.5 } | |
| Node: (391|94) { bestI: 8, bestS: 28.5 } | |
| Node: (248|23) { bestI: 6, bestS: 30.9 } | |
| Node: (149|2) { bestI: 1, bestS: 2.5 } | |
| Leaf: (113|0) | |
| Leaf: (36|2) | |
| Node: (99|21) { bestI: 7, bestS: 0.483 } | |
| Node: (62|8) { bestI: 7, bestS: 0.248 } | |
| Leaf: (26|7) | |
| Leaf: (36|1) |
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 BlackJack where | |
| import Cards | |
| import Wrapper | |
| import Test.QuickCheck | |
| import System.Random | |
| {- 3.2 | |
| size hand 2 = size (some card (Numeric 2) Hearts)(some(card Jack Spades) Empty)) | |
| = 1 + size (some(card Jack Spades)Empty)) = 1 + 1 + size(Empty) = 1 + 1 + 0 = 2 |
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
| class WordNgram{ | |
| private int size; | |
| private String[] words ={}; | |
| public WordNgram(int size){ | |
| this.size = size; | |
| } | |
| public WordNgram(int size, String words){ | |
| this.size = size; |
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
| factory :lab_has_group do | |
| repository | |
| lab | |
| lab_group do |lhg| | |
| Factory.create(:lab_group, given_course: lhg.lab.given_course) | |
| end | |
| end |
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
| import java.util.Scanner; | |
| import java.util.regex.Pattern; | |
| public class Siffra { | |
| public static void main(String[] args) { | |
| Scanner myScanner = new Scanner(System.in); | |
| String string0; | |
| System.out.print("Skriv in en sträng: "); | |
| string0 = myScanner.next(); |
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
| SELECT | |
| courses_courses.pre_req_course, COUNT(*) | |
| FROM | |
| courses_courses | |
| WHERE | |
| NOT EXISTS ( | |
| SELECT | |
| completed.course | |
| FROM | |
| completed |
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
| puts "\nrandom#--\nAPA\n#++\nTHOTOHTOJHT".gsub(/#--[^#\+\+]*#\+\+/, "") |