Skip to content

Instantly share code, notes, and snippets.

@ykon
ykon / Program.cs
Last active July 26, 2017 12:21
Find similar file names, group them, display size in descending order.
/**
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@ykon
ykon / Main.scala
Last active October 19, 2017 13:00
FizzBuzz in Scala
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
package func_fizzbuzz
object Main extends App {
def commonFizzBuzz() {
println("commonFizzBuzz:")
@ykon
ykon / Program.fs
Created October 15, 2017 14:51
FizzBuzz in F#
(*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*)
open System
let commonFizzBuzz () =
printfn "commonFizzBuzz"
@ykon
ykon / main.rs
Created October 15, 2017 14:53
FizzBuzz in Rust
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
fn common_fizzbuzz() {
println!("common_fizzbuzz");
let mut i = 1;
while i <= 100 {
@ykon
ykon / Main.scala
Last active October 29, 2017 03:45
Basic FP in Scala
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
package func_basic
import scala.annotation.tailrec
object Main extends App {
@ykon
ykon / Program.fs
Last active October 24, 2017 13:18
Basic FP in F#
(*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*)
open System
open System.Collections.Generic
let proceduralSum (ns:int list): int =
let mutable sum = 0
@ykon
ykon / Hex.scala
Last active October 24, 2017 13:04
Hex string in Scala
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
package func_hex
import Integer.toHexString
import Integer.parseInt
@ykon
ykon / Hex.fs
Last active October 25, 2017 13:48
Hex string in F#
(*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*)
open System
open System.Text
let proceduralEncode (bytes:byte[]): string =
let sb = new StringBuilder(bytes.Length * 2)
@ykon
ykon / Base64.scala
Last active October 25, 2017 13:37
Base64 in Scala
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
package func_base64
// https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64
object Base64 extends App {
private val base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
@ykon
ykon / ARC4.scala
Last active October 29, 2017 03:31
ARC4 in Scala
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
package func_arc4
import scala.annotation.tailrec
object ARC4 extends App {