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
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
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" | |
} |
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
module Domain.SomeTitle exposing (..) | |
-- | |
import Json.Decode as Decode | |
exposing | |
( succeed | |
, fail | |
, map | |
, maybe |
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 | |
if ARGV.count < 2 | |
puts "Usage: swift-mlsl.rb line-length string" | |
Process.exit(0) | |
end | |
blocksize = ARGV[0].to_i | |
parts = ARGV[1].scan(/.{1,#{blocksize}}/) | |
puts "\"\"\"\n" + parts.join("\\\n") + "\n\"\"\"" |
OlderNewer