code
stringlengths
1
46.1k
label
class label
1.18k classes
domain_label
class label
21 classes
index
stringlengths
4
5
require 'find' Find.find('/your/path') do |f| puts f if f.match(/\.mp3\Z/) end
58Walk a directory/Recursively
14ruby
jgq7x
#![feature(fs_walk)] use std::fs; use std::path::Path; fn main() { for f in fs::walk_dir(&Path::new("/home/pavel/Music")).unwrap() { let p = f.unwrap().path(); if p.extension().unwrap_or("".as_ref()) == "mp3" { println!("{:?}", p); } } }
58Walk a directory/Recursively
15rust
hrsj2
import java.io.File object `package` { def walkTree(file: File): Iterable[File] = { val children = new Iterable[File] { def iterator = if (file.isDirectory) file.listFiles.iterator else Iterator.empty } Seq(file) ++: children.flatMap(walkTree(_)) } } object Test extends App { val dir = new Fi...
58Walk a directory/Recursively
16scala
phobj
(defn luhn? [cc] (let [sum (->> cc (map #(Character/digit ^char % 10)) reverse (map * (cycle [1 2])) (map #(+ (quot % 10) (mod % 10))) (reduce +))] (zero? (mod sum 10)))) (defn is-valid-isin? [isin] (and (re-matches #"^[A-Z]{2...
71Validate International Securities Identification Number
6clojure
gvv4f
int main(int argc, const char *argv[]) { const int max = 1000; int *a = malloc(max * sizeof(int)); for (int n = 0; n < max - 1; n ++) { for (int m = n - 1; m >= 0; m --) { if (a[m] == a[n]) { a[n+1] = n - m; break; } } } printf(); for (int i = 0; i < 10; i ++) printf(, a...
74Van Eck sequence
5c
c6t9c
if( @ARGV != 3 ){ printHelp(); } map( (tr/a-z/A-Z/, s/[^A-Z]//g), @ARGV ); my $cipher_decipher = $ARGV[ 0 ]; if( $cipher_decipher !~ /ENC|DEC/ ){ printHelp(); } print "Key: " . (my $key = $ARGV[ 2 ]) . "\n"; if( $cipher_decipher =~ /ENC/ ){ print "Plain-text: " . (my $plain = $ARGV[ 1 ]) . "\n"; print...
61Vigenère cipher
2perl
jge7f
(defn van-der-corput "Get the nth element of the van der Corput sequence." ([n] (van-der-corput n 2)) ([n base] (let [s (/ 1 base)] (loop [sum 0 n n scale s] (if (zero? n) sum (recur (+ sum (* (rem n base) scale)) ...
73Van der Corput sequence
6clojure
8xe05
use Devel::Size qw(size total_size); my $var = 9384752; my @arr = (1, 2, 3, 4, 5, 6); print size($var); print total_size(\@arr);
68Variable size/Get
2perl
fifd7
(defrecord Vector [x y z]) (defn dot [U V] (+ (* (:x U) (:x V)) (* (:y U) (:y V)) (* (:z U) (:z V)))) (defn cross [U V] (new Vector (- (* (:y U) (:z V)) (* (:z U) (:y V))) (- (* (:z U) (:x V)) (* (:x U) (:z V))) (- (* (:x U) (:y V)) (* (:y U) (:x V))))) (let [a (new Vector 3 4 ...
72Vector products
6clojure
x1pwk
package main import ( "fmt" "math" ) func max(a, b uint64) uint64 { if a > b { return a } return b } func min(a, b uint64) uint64 { if a < b { return a } return b } func ndigits(x uint64) (n int) { for ; x > 0; x /= 10 { n++ } return } func d...
70Vampire number
0go
hgrjq
func printAll(things ... string) {
67Variadic function
0go
vcu2m
>>> from array import array >>> argslist = [('l', []), ('c', 'hello world'), ('u', u'hello \u2641'), ('l', [1, 2, 3, 4, 5]), ('d', [1.0, 2.0, 3.14])] >>> for typecode, initializer in argslist: a = array(typecode, initializer) print a, '\tSize =', a.buffer_info()[1] * a.itemsize del a array('l') Size = 0 array('c...
68Variable size/Get
3python
tntfw
<?php $str = ; $key = ; printf(, $str); printf(, $key); $cod = encipher($str, $key, true); printf(, $cod); $dec = encipher($cod, $key, false); printf(, $dec); function encipher($src, $key, $is_encode) { $key = strtoupper($key); $src = strtoupper($src); $dest = ''; for($i = 0; $i <= strlen($src...
61Vigenère cipher
12php
tncf1
import Foundation let fileSystem = FileManager.default let rootPath = "/"
58Walk a directory/Recursively
17swift
74xrq
(defn van-eck ([] (van-eck 0 0 {})) ([val n seen] (lazy-seq (cons val (let [next (- n (get seen val n))] (van-eck next (inc n) (assoc seen val n))))))) (println "First 10 terms:" (take 10 (van-eck))) (println "Terms 991 to 1000 terms:" (take 10...
74Van Eck sequence
6clojure
5lmuz
import Data.List (sort) import Control.Arrow ((&&&)) vampires :: [Int] vampires = filter (not . null . fangs) [1 ..] fangs :: Int -> [(Int, Int)] fangs n | odd w = [] | otherwise = ((,) <*> quot n) <$> filter isfang (integerFactors n) where ndigit :: Int -> Int ndigit 0 = 0 ndigit n = 1 + ndigit (q...
70Vampire number
8haskell
is0or
def printAll( Object[] args) { args.each{ arg -> println arg } } printAll(1, 2, "three", ["3", "4"])
67Variadic function
7groovy
m39y5
num <- c(1, 3, 6, 10) object.size(num) num2 <- 1:4 object.size(num2) l <- list(a=c(1, 3, 6, 10), b=1:4) object.size(l) l2 <- list(num, num2) object.size(l2)
68Variable size/Get
13r
i0io5
package Vector; use Moose; use feature 'say'; use overload '+' => \&add, '-' => \&sub, '*' => \&mul, '/' => \&div, '""' => \&stringify; has 'x' => (is =>'rw', isa => 'Num', required => 1); has 'y' => (is =>'rw', isa => 'Num', required => 1); sub add { my($a, $b) ...
66Vector
2perl
dotnw
I rewrote the driver according to good sense, my style, and discussion. This is file main.c on Autumn 2011 ubuntu linux release. The emacs compile command output: -*- mode: compilation; default-directory: -*- Compilation started at Mon Mar 12 20:25:27 make -k CFLAGS=-Wall main.o cc -Wall -c -o main.o main.c Comp...
75Use another language to call a function
5c
lytcy
class PrintAllType t where process :: [String] -> t instance PrintAllType (IO a) where process args = do mapM_ putStrLn args return undefined instance (Show a, PrintAllType r) => PrintAllType (a -> r) where process args = \a -> process (args ++ [show a]) printAll :: (PrintAllType t)...
67Variadic function
8haskell
epwai
require 'objspace' p ObjectSpace.memsize_of(*23) p ObjectSpace.memsize_of(*24) p ObjectSpace.memsize_of(*1000)
68Variable size/Get
14ruby
3f3z7
int j;
76Variables
5c
znstx
use std::mem; fn main() {
68Variable size/Get
15rust
6t63l
def nBytes(x: Double) = ((Math.log(x) / Math.log(2) + 1e-10).round + 1) / 8 val primitives: List[(Any, Long)] = List((Byte, Byte.MaxValue), (Short, Short.MaxValue), (Int, Int.MaxValue), (Long, Long.MaxValue)) primitives.foreach(t => println(f"A Scala ${t._1.toString.drop(13)}%-5s has ${nByte...
68Variable size/Get
16scala
969m5
sizeofValue(x)
68Variable size/Get
17swift
zdztu
package main import ( "fmt" "log" "net" "net/url" ) func main() { for _, in := range []string{ "foo:
77URL parser
0go
pjubg
char rfc3986[256] = {0}; char html5[256] = {0}; void encode(const char *s, char *enc, char *tb) { for (; *s; s++) { if (tb[*s]) sprintf(enc, , tb[*s]); else sprintf(enc, , *s); while (*++enc); } } int main() { const char url[] = ; char enc[(strlen(url) * 3) + 1]; int i; for (i = 0; i < 256; i++) ...
78URL encoding
5c
lyncy
import java.util.Arrays; import java.util.HashSet; public class VampireNumbers{ private static int numDigits(long num){ return Long.toString(Math.abs(num)).length(); } private static boolean fangCheck(long orig, long fang1, long fang2){ if(Long.toString(fang1).endsWith("0") && Long.toStrin...
70Vampire number
9java
x1awy
public static void printAll(Object... things){
67Variadic function
9java
hrkjm
function printAll() { for (var i=0; i<arguments.length; i++) print(arguments[i]) } printAll(4, 3, 5, 6, 4, 3); printAll(4, 3, 5); printAll("Rosetta", "Code", "Is", "Awesome!");
67Variadic function
10javascript
abe10
'''Vigenere encryption and decryption''' from itertools import starmap, cycle def encrypt(message, key): '''Vigenere encryption of message using key.''' message = filter(str.isalpha, message.upper()) def enc(c, k): '''Single letter encryption.''' return chr(((ord(k) + ord(c) ...
61Vigenère cipher
3python
hrwjw
package main import "regexp" var r = regexp.MustCompile(`^[A-Z]{2}[A-Z0-9]{9}\d$`) var inc = [2][10]int{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}, } func ValidISIN(n string) bool { if !r.MatchString(n) { return false } var sum, p int for i := 10; i >= 0; i-- { p = 1 - p if d := n[i...
71Validate International Securities Identification Number
0go
qaaxz
#include <stdio.h> #include "_cgo_export.h" void Run() { char Buffer [1024]; size_t Size = sizeof (Buffer); if (0 == Query (Buffer, &Size)) ...
75Use another language to call a function
0go
x1hwf
import java.net.URI [ "foo:
77URL parser
7groovy
759rz
module Main (main) where import Data.Foldable (for_) import Network.URI ( URI , URIAuth , parseURI , uriAuthority , uriFragment , uriPath , uriPort ...
77URL parser
8haskell
fowd1
(declare foo)
76Variables
6clojure
93nma
class Vector: def __init__(self,m,value): self.m = m self.value = value self.angle = math.degrees(math.atan(self.m)) self.x = self.value * math.sin(math.radians(self.angle)) self.y = self.value * math.cos(math.radians(self.angle)) def __add__(self,vector): ...
66Vector
3python
fizde
mod1 = function(v, n) ((v - 1)%% n) + 1 str2ints = function(s) as.integer(Filter(Negate(is.na), factor(levels = LETTERS, strsplit(toupper(s), "")[[1]]))) vigen = function(input, key, decrypt = F) {input = str2ints(input) key = rep(str2ints(key), len = length(input)) - 1 paste(collapse = ""...
61Vigenère cipher
13r
gup47
CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' int checksum(String prefix) { def digits = prefix.toUpperCase().collect { CHARS.indexOf(it).toString() }.sum() def groups = digits.collect { CHARS.indexOf(it) }.inject([[], []]) { acc, i -> [acc[1], acc[0] + i] } def ds = groups[1].collect { (2 * it).toString(...
71Validate International Securities Identification Number
7groovy
1hhp6
typedef struct { char mask; char lead; uint32_t beg; uint32_t end; int bits_stored; }utf_t; utf_t * utf[] = { [0] = &(utf_t){0b00111111, 0b10000000, 0, 0, 6 }, [1] = &(utf_t){0b01111111, 0b00000000, 0000, 0177, 7 }, [2] = &(utf_t){0b00011111, 0b11000000, 0200, 03777, ...
79UTF-8 encode and decode
5c
75yrg
#ifdef __GLASGOW_HASKELL__ #include "Called_stub.h" extern void __stginit_Called(void); #endif #include <stdio.h> #include <HsFFI.h> int main (int argc, char * argv []) { char Buffer [1024]; size_t Size = sizeof (Buffer); hs_init(&argc, &argv); #ifdef __GLASGOW_HASKELL__ hs_add_root(__stginit_Ca...
75Use another language to call a function
8haskell
yti66
(import 'java.net.URLEncoder) (URLEncoder/encode "http://foo bar/" "UTF-8")
78URL encoding
6clojure
4235o
null
70Vampire number
11kotlin
pjhb6
null
67Variadic function
11kotlin
4vg57
module ISINVerification2 where import Data.Char (isUpper, isDigit, digitToInt) verifyISIN :: String -> Bool verifyISIN isin = correctFormat isin && mod (oddsum + multiplied_even_sum) 10 == 0 where reverted = reverse $ convertToNumber isin theOdds = fst $ collectOddandEven reverted theEvens = snd $ col...
71Validate International Securities Identification Number
8haskell
mzzyf
inline int ishex(int x) { return (x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') || (x >= 'A' && x <= 'F'); } int decode(const char *s, char *dec) { char *o; const char *end = s + strlen(s); int c; for (o = dec; s <= end; o++) { c = *s++; if (c == '+') c = ' '; else if (c == '%' && ( !ishex(*s++) || ...
80URL decoding
5c
fo1d3
struct option { const char *name, *value; int flag; }; struct option updlist[] = { { , NULL }, { , }, { , }, { , }, { NULL, NULL } }; int output_opt(FILE *to, struct option *opt) { if (opt->value == NULL) return fprintf(to, , opt->name); else if (opt->value[0] == 0) return fprintf(to, , opt->...
81Update a configuration file
5c
0wrst
void ok_hit(GtkButton *o, GtkWidget **w) { GtkMessageDialog *msg; gdouble v = gtk_spin_button_get_value((GtkSpinButton *)w[1]); const gchar *c = gtk_entry_get_text((GtkEntry *)w[0]); msg = (GtkMessageDialog *) gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, (v==75000) ? GTK_MESSAGE_INFO : GTK_M...
82User input/Graphical
5c
d8knv
public class Query { public static boolean call(byte[] data, int[] length) throws java.io.UnsupportedEncodingException { String message = "Here am I"; byte[] mb = message.getBytes("utf-8"); if (length[0] < mb.length) return false; length[0] = mb.length; System.arraycopy(mb, 0, data, 0, mb.length); r...
75Use another language to call a function
9java
d8xn9
import java.net.URI; import java.net.URISyntaxException; public class WebAddressParser{ public static void main(String[] args){ parseAddress("foo:
77URL parser
9java
0wkse
public class ISIN { public static void main(String[] args) { String[] isins = { "US0378331005", "US0373831005", "U50378331005", "US03378331005", "AU0000XVGZA3", "AU0000VXGZA3", "FR0000988040" }; for (St...
71Validate International Securities Identification Number
9java
foodv
(import 'javax.swing.JOptionPane) (let [number (-> "Enter an Integer" JOptionPane/showInputDialog Integer/parseInt) string (JOptionPane/showInputDialog "Enter a String")] [number string])
82User input/Graphical
6clojure
6fe3q
null
75Use another language to call a function
11kotlin
0wpsf
(function (lstURL) { var e = document.createElement('a'), lstKeys = [ 'hash', 'host', 'hostname', 'origin', 'pathname', 'port', 'protocol', 'search' ], fnURLParse = function (strURL) { ...
77URL parser
10javascript
d8enu
class Vector def self.polar(r, angle=0) new(r*Math.cos(angle), r*Math.sin(angle)) end attr_reader :x, :y def initialize(x, y) raise TypeError unless x.is_a?(Numeric) and y.is_a?(Numeric) @x, @y = x, y end def +(other) raise TypeError if self.class!= other.class self.class.new(@x + oth...
66Vector
14ruby
zd6tw
module VigenereCipher BASE = 'A'.ord SIZE = 'Z'.ord - BASE + 1 def encrypt(text, key) crypt(text, key,:+) end def decrypt(text, key) crypt(text, key,:-) end def crypt(text, key, dir) text = text.upcase.gsub(/[^A-Z]/, '') key_iterator = key.upcase.gsub(/[^A-Z]/, '').chars.map{|c| c.ord ...
61Vigenère cipher
14ruby
bjqkq
package main import "fmt" func v2(n uint) (r float64) { p := .5 for n > 0 { if n&1 == 1 { r += p } p *= .5 n >>= 1 } return } func newV(base uint) func(uint) float64 { invb := 1 / float64(base) return func(n uint) (r float64) { p := invb ...
73Van der Corput sequence
0go
c6z9g
(java.net.URLDecoder/decode "http%3A%2F%2Ffoo%20bar%2F")
80URL decoding
6clojure
ytq6b
int main(void) { char str[BUFSIZ]; puts(); fgets(str, sizeof(str), stdin); long num; char buf[BUFSIZ]; do { puts(); fgets(buf, sizeof(buf), stdin); num = strtol(buf, NULL, 10); } while (num != 75000); return EXIT_SUCCESS; }
83User input/Text
5c
eblav
import 'package:flutter/material.dart'; main() => runApp( OutputLabel() ); class OutputLabel extends StatefulWidget { @override _OutputLabelState createState() => _OutputLabelState(); } class _OutputLabelState extends State<OutputLabel> { String output = "output";
82User input/Graphical
18dart
se4q6
null
77URL parser
11kotlin
ebga4
package main import "fmt" func main() { const max = 1000 a := make([]int, max)
74Van Eck sequence
0go
wpheg
import Data.List (elemIndex) import Data.Maybe (maybe) vanEck :: Int -> [Int] vanEck n = reverse $ iterate go [] !! n where go [] = [0] go xxs@(x:xs) = maybe 0 succ (elemIndex x xs): xxs main :: IO () main = do print $ vanEck 10 print $ drop 990 (vanEck 1000)
74Van Eck sequence
8haskell
6fi3k
use warnings; use strict; use feature qw(say); sub fangs { my $vampire = shift; my $length = length 0 + $vampire; return if $length % 2; my $fang_length = $length / 2; my $from = '1' . '0' x ($fang_length - 1); my $to = '9' x $fang_length; my $sorted = join q(), sort s...
70Vampire number
2perl
ytz6u
function varar(...) for i, v in ipairs{...} do print(v) end end
67Variadic function
1lua
gur4j
use std::fmt; use std::ops::{Add, Div, Mul, Sub}; #[derive(Copy, Clone, Debug)] pub struct Vector<T> { pub x: T, pub y: T, } impl<T> fmt::Display for Vector<T> where T: fmt::Display, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if let Some(prec) = f.precision() { write!...
66Vector
15rust
3fyz8
object Vector extends App { case class Vector2D(x: Double, y: Double) { def +(v: Vector2D) = Vector2D(x + v.x, y + v.y) def -(v: Vector2D) = Vector2D(x - v.x, y - v.y) def *(s: Double) = Vector2D(s * x, s * y) def /(s: Double) = Vector2D(x / s, y / s) override def toString() = s"Vector($x, $y...
66Vector
16scala
m3cyc
use std::ascii::AsciiExt; static A: u8 = 'A' as u8; fn uppercase_and_filter(input: &str) -> Vec<u8> { let alphabet = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; let mut result = Vec::new(); for c in input.chars() {
61Vigenère cipher
15rust
phsbu
object Vigenere { def encrypt(msg: String, key: String) : String = { var result: String = "" var j = 0 for (i <- 0 to msg.length - 1) { val c = msg.charAt(i) if (c >= 'A' && c <= 'Z') { result += ((c + key.charAt(j) - 2 * 'A') % 26 + 'A').toChar j = (j + 1) % key.length ...
61Vigenère cipher
16scala
epoab
null
71Validate International Securities Identification Number
11kotlin
8xx0q
import Data.Ratio (Rational(..), (%), numerator, denominator) import Data.List (unfoldr) import Text.Printf (printf) newtype Rat = Rat Rational instance Show Rat where show (Rat n) = show (numerator n) <> ('/': show (denominator n)) digitsToNum :: Integer -> [Integer] -> Integer digitsToNum b = foldr1 (\d ac...
73Van der Corput sequence
8haskell
pjrbt
local url = require('socket.url') local tests = { 'foo://example.com:8042/over/there?name=ferret#nose', 'urn:example:animal:ferret:nose', 'jdbc:mysql://test_user:ouupppssss@localhost:3306/sakila?profileSQL=true', 'ftp://ftp.is.co.za/rfc/rfc1808.txt', 'http://www.ietf.org/rfc/rfc2396.txt#header1', 'ldap://[...
77URL parser
1lua
wprea
import java.util.HashMap; import java.util.Map; public class VanEckSequence { public static void main(String[] args) { System.out.println("First 10 terms of Van Eck's sequence:"); vanEck(1, 10); System.out.println(""); System.out.println("Terms 991 to 1000 of Van Eck's sequence:");...
74Van Eck sequence
9java
n0xih
function luhn (n) local revStr, s1, s2, digit, mod = n:reverse(), 0, 0 for pos = 1, #revStr do digit = tonumber(revStr:sub(pos, pos)) if pos % 2 == 1 then s1 = s1 + digit else digit = digit * 2 if digit > 9 then mod = digit % 10 ...
71Validate International Securities Identification Number
1lua
oqq8h
(import '(java.util Scanner)) (def scan (Scanner. *in*)) (def s (.nextLine scan)) (def n (.nextInt scan))
83User input/Text
6clojure
0w4sj
package main import ( "bytes" "encoding/hex" "fmt" "log" "strings" ) var testCases = []struct { rune string }{ {'A', "41"}, {'', "C3 B6"}, {'', "D0 96"}, {'', "E2 82 AC"}, {'', "F0 9D 84 9E"}, } func main() { for _, tc := range testCases {
79UTF-8 encode and decode
0go
d81ne
(() => { 'use strict';
74Van Eck sequence
10javascript
3doz0
import Foundation #if canImport(Numerics) import Numerics #endif struct Vector<T: Numeric> { var x: T var y: T func prettyPrinted(precision: Int = 4) -> String where T: CVarArg & FloatingPoint { return String(format: "[%.\(precision)f,%.\(precision)f]", x, y) } static func +(lhs: Vector, rhs: Vector) -...
66Vector
17swift
tn3fl
public class VanDerCorput{ public static double vdc(int n){ double vdc = 0; int denom = 1; while(n != 0){ vdc += n % 2.0 / (denom *= 2); n /= 2; } return vdc; } public static void main(String[] args){ for(int i = 0; i <= 10; i++){ System.out.println(vdc(i)); } } }
73Van der Corput sequence
9java
ru2g0
package main import ( "github.com/gotk3/gotk3/gtk" "log" "math/rand" "strconv" "time" ) func validateInput(window *gtk.Window, str1, str2 string) bool { n, err := strconv.ParseFloat(str2, 64) if len(str1) == 0 || err != nil || n != 75000 { dialog := gtk.MessageDialogNew( ...
82User input/Graphical
0go
75zr2
import java.nio.charset.StandardCharsets class UTF8EncodeDecode { static byte[] utf8encode(int codePoint) { char[] characters = [codePoint] new String(characters, 0, 1).getBytes StandardCharsets.UTF_8 } static int utf8decode(byte[] bytes) { new String(bytes, StandardCharsets.UTF_8)...
79UTF-8 encode and decode
7groovy
0wjsh
def query(buffer_length): message = b'Here am I' L = len(message) return message[0:L*(L <= buffer_length)]
75Use another language to call a function
3python
42m5k
package main import ( "fmt" "net/url" ) func main() { fmt.Println(url.QueryEscape("http:
78URL encoding
0go
x1rwf
from __future__ import division import math from operator import mul from itertools import product from functools import reduce def fac(n): '''\ return the prime factors for n >>> fac(600) [5, 5, 3, 2, 2, 2] >>> fac(1000) [5, 5, 5, 2, 2, 2] >>> ''' step = lambda x: 1 + x*4 - (x ...
70Vampire number
3python
mz3yh
public func convertToUnicodeScalars( str: String, minChar: UInt32, maxChar: UInt32 ) -> [UInt32] { var scalars = [UInt32]() for scalar in str.unicodeScalars { let val = scalar.value guard val >= minChar && val <= maxChar else { continue } scalars.append(val) } return scalars } p...
61Vigenère cipher
17swift
k7xhx
use strict; use English; use POSIX; use Test::Simple tests => 7; ok( validate_isin('US0378331005'), 'Test 1'); ok( ! validate_isin('US0373831005'), 'Test 2'); ok( ! validate_isin('U50378331005'), 'Test 3'); ok( ! validate_isin('US03378331005'), 'Test 4'); ok( validate_isin('AU0000XVGZA3'), 'Test 5'); ok( v...
71Validate International Securities Identification Number
2perl
4225d
null
73Van der Corput sequence
11kotlin
v9y21
package main import ( "bufio" "fmt" "io" "log" "os" "strings" "unicode" )
81Update a configuration file
0go
ucnvt
import javax.swing.JOptionPane def number = JOptionPane.showInputDialog ("Enter an Integer") as Integer def string = JOptionPane.showInputDialog ("Enter a String") assert number instanceof Integer assert string instanceof String
82User input/Graphical
7groovy
uciv9
module Main (main) where import qualified Data.ByteString as ByteString (pack, unpack) import Data.Char (chr, ord) import Data.Foldable (for_) import Data.List (intercalate) import qualified Data.Text as Text (head, singleton) import qualified Data.Text.Encoding as Text (decodeUtf8, encod...
79UTF-8 encode and decode
8haskell
5ltug
use warnings; use strict; use URI; for my $uri (do { no warnings 'qw'; qw( foo://example.com:8042/over/there?name=ferret urn:example:animal:ferret:nose jdbc:mysql://test_user:ouupppssss@localhost:3306/sakila?profileSQL=true ftp://ftp....
77URL parser
2perl
c6n9a
def normal = "http:
78URL encoding
7groovy
pjvbo
import qualified Data.Char as Char import Text.Printf encode :: Char -> String encode c | c == ' ' = "+" | Char.isAlphaNum c || c `elem` "-._~" = [c] | otherwise = printf "%%%02X" c urlEncode :: String -> String urlEncode = concatMap encode main :: IO () main = putStrLn $ urlEncode "http://foo bar/"
78URL encoding
8haskell
yt066
fun main() { println("First 10 terms of Van Eck's sequence:") vanEck(1, 10) println("") println("Terms 991 to 1000 of Van Eck's sequence:") vanEck(991, 1000) } private fun vanEck(firstIndex: Int, lastIndex: Int) { val vanEckMap = mutableMapOf<Int, Int>() var last = 0 if (firstIndex == 1...
74Van Eck sequence
11kotlin
sepq7
class Vigenere { key: string constructor(key: string) { this.key = Vigenere.formatText(key) } encrypt(plainText: string): string { return Array.prototype.map.call(Vigenere.formatText(plainText), (letter: string, index: number): string => { return String.fromCharC...
61Vigenère cipher
20typescript
n8yi5
function vdc(n, base) local digits = {} while n ~= 0 do local m = math.floor(n / base) table.insert(digits, n - m * base) n = m end m = 0 for p, d in pairs(digits) do m = m + math.pow(base, -p) * d end return m end
73Van der Corput sequence
1lua
ucmvl
typedef char const *const string; bool consume_sentinal(bool middle, string s, size_t *pos) { if (middle) { if (s[*pos] == ' ' && s[*pos + 1] == ' *pos += 5; return true; } } else { if (s[*pos] == ' *pos += 3; return true; } } ...
84UPC
5c
x12wu
import Data.Char (toUpper) import qualified System.IO.Strict as S
81Update a configuration file
8haskell
wpued
import 'dart:io' show stdout, stdin; main() { stdout.write('Enter a string: '); final string_input = stdin.readLineSync(); int number_input; do { stdout.write('Enter the number 75000: '); var number_input_string = stdin.readLineSync(); try { number_input = int.parse(number_input_string); if (number...
83User input/Text
18dart
hg3jb