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 Foods.* | |
import Sports.* | |
import Superpowers.* | |
enum class Foods { pizza, fesenjoon } | |
enum class Sports { football, volleyball } | |
enum class Superpowers { fly, disappear } | |
data class Person(val name: String) | |
infix fun Person.like(food: Foods) = println("${name} likes ${food}.") |
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
/** | |
* Convert English numbers to Persian. | |
* | |
* @param {string} value | |
* @return {string} converted string. | |
*/ | |
function faNumbers(value) { | |
if (typeof value === "number") { | |
var value = value.toString(); | |
} |
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
/** | |
* Convert English numbers to Persian. | |
* | |
* @param {string} value | |
* @return {string} converted string. | |
*/ | |
function faNumbers(value) { | |
var englishNumbers = { | |
'0': '۰', '1': '۱', '2': '۲', '3': '۳', '4': '۴', | |
'5': '۵', '6': '۶', '7': '۷', '8': '۸', '9': '۹' |
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 between(number, start, end) { | |
return number >= start && number <= end; | |
} | |
function makeWidth(day) { | |
if (between(day, 1, 9)) { return day + " " } | |
if (between(day, 10, 31)) { return day + " " } | |
return " "; | |
} |
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
/** | |
* Print a table to show all days of a specific month. | |
* | |
* Example: Farvardin, 1397 | |
* printMonthMatrix(1397, 1) | |
* | |
* J P Ch Se D Y S | |
* -------------------------------------- | |
* 3 2 1 | |
* 10 9 8 7 6 5 4 |
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/sh | |
aria2c --dir=./ --input-file=urls.txt --max-concurrent-downloads=1 --connect-timeout=60 --max-connection-per-server=16 --split=16 --min-split-size=1M --human-readable=true --download-result=full --file-allocation=none | |
date | |
# Now create this file in the same directory and paste all urls in it: urls.txt | |
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
# Tested on Python 3.6.1 | |
# install: pip install --upgrade arabic-reshaper | |
import arabic_reshaper | |
# install: pip install python-bidi | |
from bidi.algorithm import get_display | |
# install: pip install Pillow | |
from PIL import ImageFont |
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
type schoolPerson = Teacher | Director; | |
let greeting = (stranger) => | |
switch (stranger) { | |
| Teacher => "Hey professor!" | |
| Director => "Hello director." | |
}; | |
Js.log(greeting(Teacher)); | |
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
// Person.class | |
//------------------------- | |
class Person { | |
private String name; | |
public Person(String name) { | |
this.name = name; | |
} | |