This file contains 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
\documentclass{article} | |
\def\testmode{old} | |
\def\testmode{new} | |
\usepackage{xifthen,url} | |
\newcommand{\ifnew}[2]{\ifthenelse{\equal{\testmode}{new}}{#1}{#2}} | |
\ifnew{% | |
\usepackage[backend=biber]{biblatex} |
This file contains 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 () { // start of anonymous wrapper function (needed to restrict variable scope on Opera) | |
// Opera does not support @match, so re-check that we're on SE chat before doing anything | |
// if ( location.hostname != 'slack.com' ) return; | |
// Baseline MathJax URL and config, copied from SE: | |
var mathJaxURL = "//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full"; | |
var config = { | |
"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], linebreaks: { automatic:true }, EqnChunk: 50 }, | |
tex2jax: { inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ], displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno" }, |
This file contains 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
callback([ | |
{ "name": "[Q] Problem dump", | |
"description": "We discourage posts that simply state a problem out of context, and expect the community to solve it. Assuming you tried to solve it yourself and got stuck, it may be helpful if you wrote your thoughts and what you could not figure out. It will definitely draw more answers to your post. Until then, the question will be voted to be closed / downvoted. You may also want to check out [these hints](http://meta.cs.stackexchange.com/q/1284/98), or use the search engine of this site to find similar questions that were already answered." | |
}, | |
{ "name": "[Q] No effort shown, no specific question", | |
"description": "What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See [here](http://meta.cs.stackexchange.com/q/1284/98) for tips on asking questions about exercise problems. If you are uncertain |
This file contains 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
object Main extends App { | |
def foreach[B, A >: B](f : A => Unit)(tree : BT[B]) { | |
tree match { | |
case Leaf(v) => f(v) | |
case Inner(v,l,r) => { | |
foreach(f)()lgis | |
f(v) | |
foreach(f)(r) | |
} | |
} |
This file contains 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
// cf http://cs.stackexchange.com/q/54253/98 | |
// Runnable version: http://ideone.com/4GyKeB | |
class Athlete(val name: String, val endurance : Int, val speed : Int) { | |
def performance(p : Double) = { | |
p * endurance / Athlete.maxEndurance + (1-p) * speed / Athlete.maxSpeed | |
} | |
override def toString = name | |
} |
This file contains 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
// | |
// CwlCountdownLatch.swift | |
// CwlUtils | |
// | |
// Created by Raphael Reitzig on 2017/02/16. | |
// Copyright © 2017 Raphael Reitzig. All rights reserved. | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any | |
// purpose with or without fee is hereby granted, provided that the above |
This file contains 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
// Using Swift 3.0.1 | |
// see also http://stackoverflow.com/q/42514600/539599 | |
import Foundation | |
public protocol P { | |
var foo: Int { get } | |
} | |
internal protocol Q { |
This file contains 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
extension Data { | |
/** | |
Consumes the specified input stream, creating a new Data object | |
with its content. | |
- Parameter reading: The input stream to read data from. | |
- Note: Closes the specified stream. | |
*/ | |
init(reading input: InputStream) { | |
self.init() | |
input.open() |
This file contains 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 Foundation | |
extension String { | |
/** | |
Drops characters from the front and the end of this string, returning | |
what remains. | |
- Parameter first: The number of characters to drop from the beginning. | |
Values smaller than 0 are treated as 0. | |
- Parameter last: The number of characters to drop from the end. |
This file contains 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
#!/usr/bin/ruby | |
require 'json' | |
# Note: remove `callback(` and the matching `)` from the jsonp file; it should only contain a JSON array. | |
File.open(ARGV[0]) { |f| | |
comments = JSON.parse(f.read) | |
puts comments.map { |c| | |
"####{c["name"]}\n#{c["description"]}\n\n" | |
} |
OlderNewer