mirror of
https://github.com/maxmx03/dracula.nvim.git
synced 2026-09-09 23:16:18 -04:00
Initial commit
This commit is contained in:
commit
6a9d132d58
17
INSTALL.md
Normal file
17
INSTALL.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
### [Foobar](https://foobar.com)
|
||||
|
||||
#### Install using Git
|
||||
|
||||
If you are a git user, you can install the theme and keep up to date by cloning the repo:
|
||||
|
||||
git clone https://github.com/dracula/foobar.git
|
||||
|
||||
#### Install manually
|
||||
|
||||
Download using the [GitHub .zip download](https://github.com/dracula/foobar/archive/master.zip) option and unzip them.
|
||||
|
||||
#### Activating theme
|
||||
|
||||
1. Do this
|
||||
2. Then that
|
||||
3. Boom! It's working
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Dracula Theme
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
27
README.md
Normal file
27
README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Dracula for [Foobar](https://foobar.com)
|
||||
|
||||
> A dark theme for [Foobar](https://foobar.com).
|
||||
|
||||

|
||||
|
||||
## Install
|
||||
|
||||
All instructions can be found at [draculatheme.com/foobar](https://draculatheme.com/foobar).
|
||||
|
||||
## Team
|
||||
|
||||
This theme is maintained by the following person(s) and a bunch of [awesome contributors](https://github.com/dracula/foobar/graphs/contributors).
|
||||
|
||||
| [](https://github.com/zenorocha) |
|
||||
| ---------------------------------------------------------------------------------------- |
|
||||
| [Zeno Rocha](https://github.com/zenorocha) |
|
||||
|
||||
## Community
|
||||
|
||||
- [Twitter](https://twitter.com/draculatheme) - Best for getting updates about themes and new stuff.
|
||||
- [GitHub](https://github.com/dracula/dracula-theme/discussions) - Best for asking questions and discussing issues.
|
||||
- [Discord](https://draculatheme.com/discord-invite) - Best for hanging out with the community.
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](./LICENSE)
|
||||
27
sample/Dracula.yml
Normal file
27
sample/Dracula.yml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Dracula
|
||||
spec: # https://spec.draculatheme.com
|
||||
# Base https://draculatheme.com/contribute#color-palette
|
||||
background: &BACKGROUND '#282A36'
|
||||
foreground: &FOREGROUND '#F8F8F2' # 07
|
||||
selection: &SELECTION '#44475A'
|
||||
comment: &COMMENT '#6272A4'
|
||||
cyan: &CYAN '#8BE9FD' # 06
|
||||
green: &GREEN '#50FA7B' # 02
|
||||
orange: &ORANGE '#FFB86C'
|
||||
pink: &PINK '#FF79C6'
|
||||
purple: &PURPLE '#BD93F9'
|
||||
red: &RED '#F55' # 01
|
||||
yellow: &YELLOW '#F1FA8C' # 03
|
||||
|
||||
# ANSI 0–15 https://spec.draculatheme.com#sec-ANSI
|
||||
black: &BLACK '#21222C' # 00
|
||||
blue: &BLUE '#BD93F9' # 04
|
||||
magenta: &MAGENTA '#FF79C6' # 05
|
||||
bright_black: &BRIGHT_BLACK '#6272A4' # 08
|
||||
bright_red: &BRIGHT_RED '#FF6E6E' # 09
|
||||
bright_green: &BRIGHT_GREEN '#69FF94' # 10
|
||||
bright_yellow: &BRIGHT_YELLOW '#FFFFA5' # 11
|
||||
bright_blue: &BRIGHT_BLUE '#D6ACFF' # 12
|
||||
bright_magenta: &BRIGHT_MAGENTA '#FF92DF' # 13
|
||||
bright_cyan: &BRIGHT_CYAN '#A4FFFF' # 14
|
||||
bright_white: &BRIGHT_WHITE '#FFF' # 15
|
||||
18
sample/SAMPLE.md
Normal file
18
sample/SAMPLE.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Sample
|
||||
|
||||
In order to improve the quality of our screenshots, we created this folder with standardized code snippets.
|
||||
|
||||
## Instructions
|
||||
|
||||
After you're done taking a screenshot, feel free to delete this `sample` folder.
|
||||
|
||||
## Why this is cool?
|
||||
|
||||
* It contains examples of string, number, and array
|
||||
* It contains examples of single line and multi-line comments
|
||||
* It contains examples of inheritance and functions
|
||||
* It's simple, funny, and silly :)
|
||||
|
||||
## Is there a programming language missing?
|
||||
|
||||
Feel free to send a pull request. This will help new theme authors to create awesome screenshots.
|
||||
28
sample/dracula.c
Normal file
28
sample/dracula.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
struct Vampire {
|
||||
char *location;
|
||||
int birthday;
|
||||
int deathdate;
|
||||
char *weaknesses[2];
|
||||
};
|
||||
|
||||
int _calcAge(struct Vampire *v) { return v->deathdate - v->birthday; }
|
||||
|
||||
int get_age(struct Vampire *v) { return _calcAge(v); }
|
||||
|
||||
int main() {
|
||||
struct Vampire v;
|
||||
|
||||
/* There was a guy named Vlad */
|
||||
v.location = malloc(12 * sizeof(char));
|
||||
v.location = "Transylvania";
|
||||
v.birthday = 1428;
|
||||
v.deathdate = 1476;
|
||||
v.weaknesses[0] = "Sunlight";
|
||||
v.weaknesses[1] = "Garlic";
|
||||
|
||||
get_age(&v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
38
sample/dracula.c++
Normal file
38
sample/dracula.c++
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
|
||||
class Vampire {
|
||||
public:
|
||||
Vampire(std::string location, int birth_date, int death_date,
|
||||
std::vector<std::string> weaknesses)
|
||||
: _location{location},
|
||||
_birth_date{birth_date},
|
||||
_death_date{death_date},
|
||||
_weaknesses{weaknesses} {}
|
||||
|
||||
int age() { return calc_age(); }
|
||||
|
||||
private:
|
||||
std::string _location;
|
||||
int _birth_date;
|
||||
int _death_date;
|
||||
std::vector<std::string> _weaknesses;
|
||||
|
||||
int calc_age() { return _death_date - _birth_date; }
|
||||
};
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
|
||||
int main() {
|
||||
std::string location = "Transylvania";
|
||||
int birth_date = 1428, death_date = 1476;
|
||||
std::vector<std::string> weaknesses { "Sunlight", "Garlic" };
|
||||
|
||||
Vampire dracula{location, birth_date, death_date, weaknesses};
|
||||
|
||||
return 0;
|
||||
}
|
||||
13
sample/dracula.clj
Normal file
13
sample/dracula.clj
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(comment
|
||||
"Once upon a time...")
|
||||
|
||||
(ns clj-dracula)
|
||||
|
||||
(defstruct dracula :location :birth-date :death-date :weaknesses)
|
||||
|
||||
(defn age
|
||||
[vamp] (- (vamp :death-date) (vamp :birth-date)))
|
||||
|
||||
;;...there was a guy named Vlad
|
||||
(let [d (struct dracula "Transylvania" 1428 1476 '("Sunlight", "Garlic"))]
|
||||
(println (age d)))
|
||||
43
sample/dracula.cs
Normal file
43
sample/dracula.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
|
||||
public class Vampire
|
||||
{
|
||||
public string Location { get; private set; }
|
||||
public int BirthDate { get; private set; }
|
||||
public int DeathDate { get; private set; }
|
||||
public string[] Weaknesses { get; private set; }
|
||||
|
||||
public Vampire(string location, int birthDate, int deathDate, string[] weaknesses)
|
||||
{
|
||||
Location = location;
|
||||
BirthDate = birthDate;
|
||||
DeathDate = deathDate;
|
||||
Weaknesses = weaknesses;
|
||||
}
|
||||
|
||||
public int Age()
|
||||
{
|
||||
return calcAge();
|
||||
}
|
||||
|
||||
private int calcAge()
|
||||
{
|
||||
return DeathDate - BirthDate;
|
||||
}
|
||||
}
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// ...there was a guy named Vlad
|
||||
|
||||
var vampire = new Vampire(
|
||||
"Transylvania",
|
||||
1428,
|
||||
1476,
|
||||
new string[] { "Sunlight", "Garlic" }
|
||||
);
|
||||
}
|
||||
}
|
||||
33
sample/dracula.css
Normal file
33
sample/dracula.css
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
|
||||
:root {
|
||||
--birthDate: 1428px;
|
||||
--deathDate: 1476px;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #000;
|
||||
}
|
||||
|
||||
/* ...there was a guy named Vlad */
|
||||
|
||||
#dracula {
|
||||
opacity: 0;
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
font-family: "Transylvania";
|
||||
height: calc(var(--deathDate) - var(--birthDate));
|
||||
}
|
||||
|
||||
.cape {
|
||||
background: #ff0000 !important;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Transylvania";
|
||||
src: url("/location/Transylvania.woff2") format("woff2");
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
}
|
||||
24
sample/dracula.dart
Normal file
24
sample/dracula.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
|
||||
class Vampire {
|
||||
String location;
|
||||
int birthDate, deathDate;
|
||||
List<String> weaknesses;
|
||||
|
||||
Vampire({this.location, this.birthDate, this.deathDate, this.weaknesses});
|
||||
|
||||
int get age => this.calcAge();
|
||||
|
||||
int calcAge() => this.deathDate - this.birthDate;
|
||||
}
|
||||
|
||||
void main() {
|
||||
// ...there was a guy named Vlad
|
||||
final Dracula = Vampire(
|
||||
location: 'Transylvania',
|
||||
birthDate: 1428,
|
||||
deathDate: 1476,
|
||||
weaknesses: ['Sunlight', 'Garlic']);
|
||||
}
|
||||
33
sample/dracula.ex
Normal file
33
sample/dracula.ex
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
defmodule Vampire do
|
||||
@moduledoc """
|
||||
Once upon a time...
|
||||
"""
|
||||
|
||||
defstruct [:location, :birth_date, :death_date, :weaknesses]
|
||||
|
||||
def new(props) do
|
||||
%__MODULE__{
|
||||
location: props[:location],
|
||||
birth_date: props[:birth_date],
|
||||
death_date: props[:death_date],
|
||||
weaknesses: props[:weaknesses]
|
||||
}
|
||||
end
|
||||
|
||||
def age(vampire) do
|
||||
calc_age(vampire)
|
||||
end
|
||||
|
||||
defp calc_age(vampire) do
|
||||
vampire.death_date - vampire.birth_date
|
||||
end
|
||||
end
|
||||
|
||||
# ...there was a guy named Vlad
|
||||
|
||||
dracula = Vampire.new(
|
||||
location: "Transylvania",
|
||||
birthDate: 1428,
|
||||
deathDate: 1476,
|
||||
weaknesses: ["Sunlight", "Garlic"]
|
||||
)
|
||||
34
sample/dracula.go
Normal file
34
sample/dracula.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
/*
|
||||
Once upon a time...
|
||||
*/
|
||||
type Vampire struct {
|
||||
Location string
|
||||
BirthDate int
|
||||
DeathDate int
|
||||
Weaknesses []string
|
||||
}
|
||||
|
||||
func (v *Vampire) Age() int {
|
||||
return v.calcAge()
|
||||
}
|
||||
|
||||
func (v *Vampire) calcAge() int {
|
||||
return v.DeathDate - v.BirthDate
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
|
||||
func main() {
|
||||
dracula := &Vampire{
|
||||
Location: "Transylvania",
|
||||
BirthDate: 1428,
|
||||
DeathDate: 1476,
|
||||
Weaknesses: []string{"Sunlight", "Garlic"},
|
||||
}
|
||||
|
||||
fmt.Println(dracula.Age())
|
||||
}
|
||||
34
sample/dracula.html
Normal file
34
sample/dracula.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Dracula</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Once upon a time... -->
|
||||
<h1>Vampires</h1>
|
||||
|
||||
<form>
|
||||
<label for="location">Location</label>
|
||||
<input type="text" name="location" value="Transylvania">
|
||||
<label for="birthDate">Birth Date:</label>
|
||||
<input type="number" name="birthDate" value="1428">
|
||||
<label for="deathDate">Death Date:</label>
|
||||
<input type="number" name="deathDate" value="1476">
|
||||
<label for="weaknesses">Weaknesses:</label>
|
||||
<input type="checkbox" name="weaknesses" value="Sunlight" checked>
|
||||
<input type="checkbox" name="weaknesses" value="Garlic" checked>
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// ...there was a guy named Vlad
|
||||
const form = document.querySelector('form');
|
||||
form.addEventListener('submit', (e) => {
|
||||
const { birthDate, deathDate } = e.target;
|
||||
const age = deathDate.value - birthDate.value;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
30
sample/dracula.java
Normal file
30
sample/dracula.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
class Vampire {
|
||||
private String location;
|
||||
private int birthDate;
|
||||
private int deathDate;
|
||||
private String[] weaknesses;
|
||||
|
||||
public Vampire(String location, int birthDate, int deathDate, String[] weaknesses) {
|
||||
this.location = location;
|
||||
this.birthDate = birthDate;
|
||||
this.deathDate = deathDate;
|
||||
this.weaknesses = weaknesses;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return this.calcAge();
|
||||
}
|
||||
|
||||
public int calcAge() {
|
||||
return this.deathDate - this.birthDate;
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
public class dracula {
|
||||
Vampire vampire = new Vampire(
|
||||
"Transylvania",
|
||||
1428,
|
||||
1476,
|
||||
new String[] { "Sunlight", "Garlic" });
|
||||
}
|
||||
27
sample/dracula.js
Normal file
27
sample/dracula.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
class Vampire {
|
||||
constructor(props) {
|
||||
this.location = props.location;
|
||||
this.birthDate = props.birthDate;
|
||||
this.deathDate = props.deathDate;
|
||||
this.weaknesses = props.weaknesses;
|
||||
}
|
||||
|
||||
get age() {
|
||||
return this.calcAge();
|
||||
}
|
||||
|
||||
calcAge() {
|
||||
return this.deathDate - this.birthDate;
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
const Dracula = new Vampire({
|
||||
location: 'Transylvania',
|
||||
birthDate: 1428,
|
||||
deathDate: 1476,
|
||||
weaknesses: ['Sunlight', 'Garlic']
|
||||
});
|
||||
27
sample/dracula.kt
Normal file
27
sample/dracula.kt
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Once upon a time ...
|
||||
*/
|
||||
|
||||
class Vampire(
|
||||
val location: String,
|
||||
val birthDate: Int,
|
||||
val deathDate: Int,
|
||||
val weaknesses: Array<String>
|
||||
) {
|
||||
val age: Int
|
||||
get() = this.calcAge()
|
||||
|
||||
fun calcAge() =
|
||||
this.deathDate - this.birthDate
|
||||
}
|
||||
|
||||
// ... there was a guy named Vlad
|
||||
|
||||
fun main() {
|
||||
Vampire(
|
||||
"Transylvania",
|
||||
1428,
|
||||
1476,
|
||||
arrayOf("Sunlight", "Garlic")
|
||||
)
|
||||
}
|
||||
17
sample/dracula.md
Normal file
17
sample/dracula.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<!--
|
||||
Once a upon a time...
|
||||
-->
|
||||
|
||||
# Vampires
|
||||
|
||||
| Name | Value |
|
||||
|------------|------------------|
|
||||
| location | Transylvania |
|
||||
| birth date | 1428 |
|
||||
| death date | 1476 |
|
||||
| weaknesses | Sunlight, Garlic |
|
||||
|
||||
<!-- ...There was a guy named Vlad -->
|
||||
|
||||
> The **age** is the `deathDate` minus the `birthDate`
|
||||
|
||||
34
sample/dracula.php
Normal file
34
sample/dracula.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
class Vampire {
|
||||
public string $location;
|
||||
public int $birthDate;
|
||||
public int $deathDate;
|
||||
public array $weaknesses;
|
||||
|
||||
public function __construct(array $props) {
|
||||
$this->location = $props['location'];
|
||||
$this->birthDate = $props['birthDate'];
|
||||
$this->deathDate = $props['deathDate'];
|
||||
$this->weaknesses = $props['weaknesses'];
|
||||
}
|
||||
|
||||
public function age(): int {
|
||||
return $this->calcAge();
|
||||
}
|
||||
|
||||
private function calcAge(): int {
|
||||
return $this->deathDate - $this->birthDate;
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
$Dracula = new Vampire([
|
||||
'location' => 'Transylvania',
|
||||
'birthDate' => 1428,
|
||||
'deathDate' => 1476,
|
||||
'weaknesses' => ['Sunlight', 'Garlic']
|
||||
]);
|
||||
?>
|
||||
23
sample/dracula.py
Normal file
23
sample/dracula.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Once upon a time...
|
||||
|
||||
class Vampire:
|
||||
def __init__(self, props):
|
||||
self.location = props['location']
|
||||
self.birthDate = props['birthDate']
|
||||
self.deathDate = props['deathDate']
|
||||
self.weaknesses = props['weaknesses']
|
||||
|
||||
def get_age(self):
|
||||
return self.calc_age()
|
||||
|
||||
def calc_age(self):
|
||||
return self.deathDate - self.birthDate
|
||||
|
||||
# ...there was a guy named Vlad
|
||||
|
||||
Dracula = Vampire({
|
||||
'location': 'Transylvania',
|
||||
'birthDate': 1428,
|
||||
'deathDate': 1476,
|
||||
'weaknesses': ['Sunlight', 'Garlic']
|
||||
})
|
||||
33
sample/dracula.rb
Normal file
33
sample/dracula.rb
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# Once upon a time...
|
||||
#
|
||||
|
||||
class Vampire
|
||||
def initialize(opts)
|
||||
@location = opts[:location]
|
||||
@birthDate = opts[:birthDate]
|
||||
@deathDate = opts[:deathDate]
|
||||
@weaknesses = opts[:weaknesses]
|
||||
end
|
||||
|
||||
def age
|
||||
calcAge
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def calcAge
|
||||
@deathDate - @birthDate
|
||||
end
|
||||
end
|
||||
|
||||
# ...there was a guy named Vlad
|
||||
|
||||
dracula = Vampire.new(
|
||||
location: 'Transylvania',
|
||||
birthDate: 1428,
|
||||
deathDate: 1476,
|
||||
weaknesses: %w[Sunlight Garlic]
|
||||
)
|
||||
|
||||
puts dracula.age
|
||||
46
sample/dracula.rs
Normal file
46
sample/dracula.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Once upon a time...
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Vampire {
|
||||
location: String,
|
||||
birth_date: u16,
|
||||
death_date: u16,
|
||||
weaknesses: Vec<String>,
|
||||
}
|
||||
|
||||
impl Vampire {
|
||||
pub fn new(
|
||||
location: String,
|
||||
birth_date: u16,
|
||||
death_date: u16,
|
||||
weaknesses: Vec<String>,
|
||||
) -> Self {
|
||||
Vampire {
|
||||
location,
|
||||
birth_date,
|
||||
death_date,
|
||||
weaknesses,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn age(&self) -> u16 {
|
||||
self.calc_age()
|
||||
}
|
||||
|
||||
fn calc_age(&self) -> u16 {
|
||||
self.death_date - self.birth_date
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
|
||||
fn main() {
|
||||
let dracula = Vampire::new(
|
||||
"Transylvania".to_string(),
|
||||
1428,
|
||||
1476,
|
||||
vec!["Sunlight".to_string(), "Garlic".to_string()],
|
||||
);
|
||||
|
||||
println!("{:?}", dracula);
|
||||
}
|
||||
15
sample/dracula.scala
Normal file
15
sample/dracula.scala
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
class Vampire(location: String, birthDate: Int, deathDate: Int, weaknesses: Array[String]) {
|
||||
def age(): Int = {
|
||||
calcAge()
|
||||
}
|
||||
|
||||
def calcAge(): Int = {
|
||||
this.deathDate - this.birthDate
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
val dracula = new Vampire(location = "Transylvania", birthDate = 1428, deathDate = 1476, weaknesses = Array("Sunlight", "Garlic"))
|
||||
22
sample/dracula.sml
Normal file
22
sample/dracula.sml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(*
|
||||
* Once upon a time...
|
||||
*)
|
||||
|
||||
structure Vampire = struct
|
||||
type params = {location: string,
|
||||
birthDate: int,
|
||||
deathDate: int,
|
||||
weaknesses: string list}
|
||||
type vampire = params
|
||||
fun new (v : params) : vampire = v
|
||||
fun age (v : vampire) : int = (#deathDate v) - (#birthDate v)
|
||||
end
|
||||
|
||||
(* ...there was a guy named Vlad *)
|
||||
|
||||
structure Romainia = struct
|
||||
val dracula = Vampire.new {location="Transylvania",
|
||||
birthDate=1428,
|
||||
deathDate=1476,
|
||||
weaknesses=["Sunlight", "Garlic"]}
|
||||
end
|
||||
29
sample/dracula.swift
Normal file
29
sample/dracula.swift
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
|
||||
class Vampire {
|
||||
var location: String
|
||||
var birthDate: Int
|
||||
var deathDate: Int
|
||||
var weaknesses: [String]
|
||||
|
||||
init(location: String, birthDate: Int, deathDate: Int, weaknesses: [String]) {
|
||||
self.location = location
|
||||
self.birthDate = birthDate
|
||||
self.deathDate = deathDate
|
||||
self.weaknesses = weaknesses
|
||||
}
|
||||
|
||||
var age: Int {
|
||||
self.calcAge()
|
||||
}
|
||||
|
||||
func calcAge() -> Int {
|
||||
self.deathDate - self.birthDate
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
|
||||
let dracula = Vampire(location: "Transylvania", birthDate: 1428, deathDate: 1476, weaknesses: ["Sunlight", "Garlic"])
|
||||
41
sample/dracula.ts
Normal file
41
sample/dracula.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Once upon a time...
|
||||
*/
|
||||
|
||||
interface VampireProps {
|
||||
location: string;
|
||||
birthDate: number;
|
||||
deathDate: number;
|
||||
weaknesses: string[];
|
||||
}
|
||||
|
||||
class Vampire {
|
||||
location: string;
|
||||
birthDate: number;
|
||||
deathDate: number;
|
||||
weaknesses: string[];
|
||||
|
||||
constructor(props: VampireProps) {
|
||||
this.location = props.location;
|
||||
this.birthDate = props.birthDate;
|
||||
this.deathDate = props.deathDate;
|
||||
this.weaknesses = props.weaknesses;
|
||||
}
|
||||
|
||||
get age(): number {
|
||||
return this.calcAge();
|
||||
}
|
||||
|
||||
calcAge(): number {
|
||||
return this.deathDate - this.birthDate;
|
||||
}
|
||||
}
|
||||
|
||||
// ...there was a guy named Vlad
|
||||
|
||||
const Dracula: VampireProps = new Vampire({
|
||||
location: 'Transylvania',
|
||||
birthDate: 1428,
|
||||
deathDate: 1476,
|
||||
weaknesses: ['Sunlight', 'Garlic'],
|
||||
});
|
||||
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 249 KiB |
Loading…
Reference in a new issue