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
<!doctype html> | |
<html> | |
<head> | |
<style type="text/css"> | |
body { | |
background-color: #f0f0f0; | |
} | |
.Page { | |
left: 50%; |
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
function subsequenceWithLargestSum(xs) { | |
var n = xs.length; | |
var start = 0; | |
var runningSum = 0; | |
var largestStart = 0; | |
var largestEnd = 0; | |
var largestSum = 0; | |
for (var i = 0; i < n; i++) { |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Goodbye cruel world</title> | |
</head> | |
<body> | |
<p>Hello cruel world</p> | |
<iframe src="https://twitter.com/i/videos/live_video/738315305816248320?embed_source=clientlib&player_id=0&rpc_init=1&conviva_environment=production" allowfullscreen="" id="player_live_video_738315305816248320" style="width: 100%; height: 100%; position: absolute; top: 0; left: 0;"></iframe> | |
</body> |
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
function countChars(word) { | |
var counts = {}; | |
for (var i = 0; i < word.length; i++) { | |
var letter = word[i]; | |
if (letter in counts && counts.hasOwnProperty(letter)) { | |
counts[letter]++; | |
} else { | |
counts[letter] = 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
function countChars(word) { | |
var counts = {}; | |
for (var i = 0; i < word.length; i++) { | |
var letter = word[i]; | |
if (letter in counts && counts.hasOwnProperty(letter)) { | |
counts[letter]++; | |
} else { | |
counts[letter] = 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
case class Position(x: Int, y: Int) | |
object Grid { | |
val Width = 10 | |
val Height = 10 | |
val grid = Map( | |
Position(0, 0) -> true | |
) |
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 Data.List (groupBy) | |
import Data.Function (on) | |
section :: String -> String | |
section = takeWhile (/= ',') | |
groupBySection :: [String] -> [[String]] | |
groupBySection = groupBy ((==) `on` section) | |
top15 :: [String] -> [String] |
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 MAX(c.section_id) section_id, MAX(t.tag_web_title) contributor_name, COUNT(DISTINCT c.id) articles_published | |
FROM content_dim c RIGHT JOIN content_tag_lookup t ON c.content_key = t.content_key | |
WHERE t.tag_type = 'contributor' | |
GROUP BY tag_id, section_id | |
ORDER BY section_id ASC, articles_published DESC; |
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
case class Front(containers: Seq[Container]) | |
case class Container(slices: Seq[Slice]) | |
case class Slice(columns: Seq[Column]) | |
case class Column(cards: Seq[Card]) |
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
sealed trait Foo | |
case class Bar(a: Int) extends Foo | |
case class Baz(b: Int) extends Foo | |
object FooJson { | |
def fromFoo(foo: Foo) = foo match { | |
case Bar(a) => FooJson("bar", Some(a), None) | |
case Baz(b) => FooJson("baz", None, Some(b)) | |
} |
NewerOlder