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
// Start writing your ScalaFiddle code here | |
import monix.reactive._ | |
import monix.eval._ | |
import cats.effect._ | |
import cats.effect.syntax._ | |
import monix.execution.Scheduler.Implicits.global | |
import scala.concurrent.duration._ |
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
require(ggplot2) | |
library(ggplot2) | |
df <- read.table(header=T, text=' x y | |
1 -1 | |
2 -1.5 | |
3 -1.6 | |
4 -1.7 | |
5 -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
import java.lang.management.ManagementFactory | |
/** | |
* Benchmark to measure performance of computing profile of Tetris stack. | |
* http://stackoverflow.com/questions/29309942/how-to-compute-the-height-profile-of-a-tetris-stack-most-efficiently | |
* | |
* This code may be used under MIT license. | |
*/ | |
val width = 10 |
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 System.IO | |
import Control.Monad | |
import Control.Applicative | |
import Data.Graph | |
import Data.Array | |
type Player = Int | |
data ZoneState = ZoneState { zoneOwner :: Player, zonePODs :: [Int] } deriving (Show, Eq) |
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
// ==UserScript== | |
// @name Google Scholar Download BibTex | |
// @namespace https://gist.github.com/ziggystar | |
// @description Changes the links to BibTex citations such that they are opened/downloaded instead of displayed inside the browser. This allows automatic importing of entries into external programs. | |
// @include http://scholar.google.de/* | |
// @include https://scholar.google.de/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== |
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
// ==UserScript== | |
// @namespace http://tgeier.de/user.js | |
// @name Amboss Inline | |
// @version 0.2 | |
// @description Inlines the tool-tips on amboss pages for better printing. | |
// @include https://amboss.miamed.de/* | |
// @run-at document-end | |
// ==/UserScript== | |
var column = document.getElementsByClassName("Column")[0]; |
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
/** | |
Benchmark for the question "For comprehension and number of function creation" on SO. (http://stackoverflow.com/q/23737147/108915) | |
Answer: http://stackoverflow.com/a/23742289/108915 | |
*/ | |
object M { | |
def useIt(): Unit = { | |
println(variantA()) |
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> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/> | |
<script src="http://cmx.io/v/0.1/cmx.js"></script> | |
<body> | |
<scene id="scene1"> | |
<label t="translate(0,346)"> | |
<tspan x="0" y="0em">One winter morning</tspan> | |
</label> | |
<actor t="translate(138,34)" pose="-70,12|-72,125|-70,102|-70,92|-70,82|-70,62|-75,37|-80,12|-65,37|-60,12|-77,82|-76,64|-65,82|-60,62"> |
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
#include <vector> | |
#include <set> | |
#include <iostream> | |
#include <functional> | |
#include <algorithm> | |
#include <assert.h> | |
using namespace std; | |
template<class Container> |
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
/** Find the minimum amount of smoke (second) and resulting color (first) | |
by splitting the sequence at every possible position, | |
given `lookup` contains the best mix for subsequence. */ | |
def minSmokeMixtureSingle(s: Seq[Int], lookup: Map[Seq[Int],(Int,Int)]): (Int,Int) = | |
if(s.size == 1) | |
(s(0),0) | |
else if(s.size == 2) | |
mix(s(0),s(1)) | |
else { | |
val splits = (1 to (s.size - 1)).map(s.splitAt) |