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
/** | |
* Inverse Fizzbuzz | |
* http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html | |
**/ | |
object InverseFizzBuzz extends App { | |
val fizzbuzz = new PartialFunction[Int, (Int, String)] { | |
def apply(x:Int) = (x, (x%3,x%5) match { | |
case (0, 0) => "fizzbuzz" | |
case (0, _) => "fizz" |
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 java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* Inverse Fizzbuzz (for Java) | |
* http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html | |
*/ | |
public class InvFizzBuzz { | |
public List<Integer> process(String[] args) { |
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
(define (fringe items) | |
(define (fringe-iter items res) | |
(cond ((null? items) res) | |
((pair? (car items)) | |
(fringe-iter (append (car items) (cdr items)) res)) | |
(else | |
(fringe-iter (cdr items) (cons (car items) res))))) | |
(reverse (fringe-iter items (list)))) |
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
public ViewObject getViewObject(String bindingName) { | |
BindingContext ctx = BindingContext.getCurrent(); | |
ControlBinding b = | |
ctx.getCurrentBindingsEntry().getControlBinding(bindingName); | |
if (b == null) { | |
throw new IllegalArgumentException(bindingName + " is not found."); | |
} | |
if (! (b instanceof DCControlBinding)) { | |
throw new IllegalArgumentException(bindingName + " is not DCControlBinding."); | |
} |
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 java.math.BigInteger; | |
import java.util.function.UnaryOperator; | |
import java.util.stream.Stream; | |
import static java.math.BigInteger.*; | |
public class Fibonacci implements UnaryOperator<BigInteger> { | |
@Override | |
public BigInteger apply(BigInteger 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
#!/bin/bash | |
# | |
# git-completion & git-prompt を導入するスクリプト(for bash) | |
# git, curl, unzip を事前にインストールしておくこと | |
# | |
set -eux | |
set -o pipefail |
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
# Make a temporary dir, and remove when exit. | |
TEMPDIR=$(mktemp -d) | |
trap "rm -rf ${TEMPDIR}" EXIT |
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
sudo apt-get update | |
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-commo | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' | |
sudo apt-get update | |
sudo apt-get install -y docker-ce code |
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
FROM java:9-jdk | |
EXPOSE 8000 | |
VOLUME ["/dynamodb/data"] | |
RUN mkdir -p /dynamodb | |
WORKDIR /dynamodb | |
# see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html | |
RUN wget https://s3-ap-northeast-1.amazonaws.com/dynamodb-local-tokyo/dynamodb_local_latest.tar.gz -qO ./dynamodb_local.tar.gz \ |
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
--enable-sockets | |
--enable-exif | |
--with-zlib | |
--with-zlib-dir=/usr/local/opt/zlib | |
--with-bz2=/usr/local/opt/bzip2 | |
--enable-intl | |
--with-kerberos | |
--with-openssl | |
--enable-soap | |
--enable-xmlreader |
OlderNewer