Skip to content

Commit ec4bf18

Browse files
committed
docs: added example files
1 parent cd1e064 commit ec4bf18

File tree

17 files changed

+459
-0
lines changed

17 files changed

+459
-0
lines changed

examples/.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
max_line_length = off
14+
trim_trailing_whitespace = false

examples/css.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.someClass {
2+
font-family: serif;
3+
}
4+
5+
#someID {
6+
background: yellow;
7+
}
8+
9+
main {
10+
margin-top: 20px;
11+
}

examples/elm.elm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
main : Program Never Model Msg
2+
main =
3+
program
4+
{ init = init
5+
, view = view
6+
, update = update
7+
, subscriptions = subscriptions
8+
}

examples/html.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<div id="app">Tacos Tacos</div>
11+
<p>Tacos tacos tacos</p>
12+
<!--comment-->
13+
<script>
14+
var x = '100';
15+
x.toString();
16+
</script>
17+
</body>
18+
</html>

examples/js.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
'use strict'
2+
class Sale {
3+
constructor(price) {
4+
;[this.decoratorsList, this.price] = [[], price]
5+
}
6+
7+
decorate(decorator) {
8+
if (!Sale[decorator]) throw new Error(`decorator not exist: ${decorator}`)
9+
this.decoratorsList.push(Sale[decorator])
10+
}
11+
12+
getPrice() {
13+
for (let decorator of this.decoratorsList) {
14+
this.price = decorator(this.price)
15+
}
16+
return this.price.toFixed(2)
17+
}
18+
19+
static quebec(price) {
20+
// this is a comment
21+
return price + price * 7.5 / 100
22+
}
23+
24+
static fedtax(price) {
25+
return price + price * 5 / 100
26+
}
27+
}
28+
29+
let sale = new Sale(100)
30+
sale.decorate('fedtax')
31+
sale.decorate('quebec')
32+
console.log(sale.getPrice()) //112.88
33+
34+
getPrice()
35+
36+
//deeply nested
37+
38+
async function asyncCall() {
39+
var result = await resolveAfter2Seconds();
40+
}
41+
42+
const options = {
43+
connections: {
44+
compression: false
45+
}
46+
}
47+
48+
for (let i = 0; i < 10; i++) {
49+
continue;
50+
}
51+
52+
if (true) { }
53+
54+
while (true) { }
55+
56+
switch (2) {
57+
case 2:
58+
break;
59+
default:
60+
break;
61+
}
62+
63+
class EditFishForm extends Component {
64+
static propTypes = {
65+
updateFish: PropTypes.func,
66+
deleteFish: PropTypes.func,
67+
index: PropTypes.string,
68+
fish: PropTypes.shape({
69+
image: PropTypes.string,
70+
name: PropTypes.string.isRequired
71+
})
72+
}
73+
}

examples/json.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"mocha": true,
5+
"node": true
6+
},
7+
"extends": "eslint:recommended",
8+
"rules": {
9+
"indent": ["error", 2],
10+
"linebreak-style": ["error", "unix"],
11+
"quotes": ["error", "single"],
12+
"semi": ["error", "always"]
13+
}
14+
}

examples/markdown.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Yell Theme
2+
3+
> Yell theme for VS Code.
4+
5+
![Preview](images/preview.gif)
6+
7+
# Installation
8+
9+
1. Install [Visual Studio Code](https://code.visualstudio.com/)
10+
2. Launch Visual Studio Code
11+
3. Choose **Extensions** from menu
12+
4. Search for `yell`
13+
5. Click **Install** to install it
14+
6. Click **Reload** to reload the Code
15+
7. File > Preferences > Color Theme > **Yell**
16+
17+
-[ ] check check 12 12
18+
-[ ] check check 12 12
19+
20+
Heading 1
21+
========
22+
23+
Heading 2
24+
--------------
25+
26+
### Heading 3

examples/php.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
class HelloWorldTest extends PHPUnit_Framework_TestCase
3+
{
4+
/**
5+
* @var PDO
6+
*/
7+
private $pdo;
8+
public function setUp()
9+
{
10+
$this->pdo = new PDO($GLOBALS['db_dsn'], $GLOBALS['db_username'], $GLOBALS['db_password']);
11+
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
12+
$this->pdo->query("CREATE TABLE hello (what VARCHAR(50) NOT NULL)");
13+
}
14+
public function tearDown()
15+
{
16+
$this->pdo->query("DROP TABLE hello");
17+
}
18+
public function testHelloWorld()
19+
{
20+
$helloWorld = new HelloWorld($this->pdo);
21+
$this->assertEquals('Hello World', $helloWorld->hello());
22+
}
23+
public function testHello()
24+
{
25+
$helloWorld = new HelloWorld($this->pdo);
26+
$this->assertEquals('Hello Bar', $helloWorld->hello('Bar'));
27+
}
28+
public function testWhat()
29+
{
30+
$helloWorld = new HelloWorld($this->pdo);
31+
$this->assertFalse($helloWorld->what());
32+
$helloWorld->hello('Bar');
33+
$this->assertEquals('Bar', $helloWorld->what());
34+
}
35+
}
36+
?>

examples/pug.pug

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
html(lang="en")
3+
4+
head
5+
meta(charset="UTF-8")
6+
meta(name="viewport", content="width=device-width, initial-scale=1.0")
7+
meta(http-equiv="X-UA-Compatible", content="ie=edge")
8+
title Document
9+
10+
body
11+
h1 Pug

examples/python.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from collections import deque
2+
3+
def topo(G, ind=None, Q=[1]):
4+
if ind == None:
5+
ind = [0] * (len(G) + 1) # this is a comment
6+
for u in G:
7+
for v in G[u]:
8+
ind[v] += 1
9+
Q = deque()
10+
for i in G:
11+
if ind[i] == 0:
12+
Q.append(i)
13+
if len(Q) == 0:
14+
return
15+
v = Q.popleft()
16+
print(v)
17+
for w in G[v]:
18+
ind[w] -= 1
19+
if ind[w] == 0:
20+
Q.append(w)
21+
topo(G, ind, Q)
22+
23+
24+
class SomeClass:
25+
def create_arr(self): # An instance method
26+
self.arr = []
27+
28+
def insert_to_arr(self, value): #An instance method
29+
self.arr.append(value)
30+
31+
@classmethod
32+
def class_method(cls):
33+
print("the class method was called")

0 commit comments

Comments
 (0)