mirror of
https://gitlab.com/djdietrick/docs
synced 2026-05-03 00:20:54 -04:00
Compare commits
2 Commits
d14a1a05c8
...
894a15525a
| Author | SHA1 | Date | |
|---|---|---|---|
| 894a15525a | |||
| 2b8ca93fab |
46
docs/.vitepress/cache/deps/@theme_index.js
vendored
46
docs/.vitepress/cache/deps/@theme_index.js
vendored
@@ -9,31 +9,31 @@ import {
|
||||
} from "./chunk-3YS4HNIT.js";
|
||||
|
||||
// node_modules/vitepress/dist/client/theme-default/index.js
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/fonts.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/fonts.css";
|
||||
|
||||
// node_modules/vitepress/dist/client/theme-default/without-fonts.js
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/vars.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/base.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/utils.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/custom-block.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code-group.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-doc.css";
|
||||
import "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-sponsor.css";
|
||||
import VPBadge from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
|
||||
import Layout from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/Layout.vue";
|
||||
import { default as default2 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
|
||||
import { default as default3 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPImage.vue";
|
||||
import { default as default4 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPButton.vue";
|
||||
import { default as default5 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPHomeHero.vue";
|
||||
import { default as default6 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPHomeFeatures.vue";
|
||||
import { default as default7 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPHomeSponsors.vue";
|
||||
import { default as default8 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPDocAsideSponsors.vue";
|
||||
import { default as default9 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPSponsors.vue";
|
||||
import { default as default10 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamPage.vue";
|
||||
import { default as default11 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageTitle.vue";
|
||||
import { default as default12 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageSection.vue";
|
||||
import { default as default13 } from "/Users/djdietrick/Git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamMembers.vue";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/vars.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/base.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/utils.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/custom-block.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code-group.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-doc.css";
|
||||
import "C:/git/docs/node_modules/vitepress/dist/client/theme-default/styles/components/vp-sponsor.css";
|
||||
import VPBadge from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
|
||||
import Layout from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/Layout.vue";
|
||||
import { default as default2 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
|
||||
import { default as default3 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPImage.vue";
|
||||
import { default as default4 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPButton.vue";
|
||||
import { default as default5 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPHomeHero.vue";
|
||||
import { default as default6 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPHomeFeatures.vue";
|
||||
import { default as default7 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPHomeSponsors.vue";
|
||||
import { default as default8 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPDocAsideSponsors.vue";
|
||||
import { default as default9 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPSponsors.vue";
|
||||
import { default as default10 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamPage.vue";
|
||||
import { default as default11 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageTitle.vue";
|
||||
import { default as default12 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageSection.vue";
|
||||
import { default as default13 } from "C:/git/docs/node_modules/vitepress/dist/client/theme-default/components/VPTeamMembers.vue";
|
||||
|
||||
// node_modules/vitepress/dist/client/shared.js
|
||||
var inBrowser = typeof document !== "undefined";
|
||||
|
||||
16
docs/.vitepress/cache/deps/_metadata.json
vendored
16
docs/.vitepress/cache/deps/_metadata.json
vendored
@@ -1,31 +1,31 @@
|
||||
{
|
||||
"hash": "b31dd5f2",
|
||||
"configHash": "9af315cb",
|
||||
"lockfileHash": "951d497c",
|
||||
"browserHash": "14d9b0dd",
|
||||
"hash": "3c715ca3",
|
||||
"configHash": "9ebaad5b",
|
||||
"lockfileHash": "ebeae15b",
|
||||
"browserHash": "0b0ad317",
|
||||
"optimized": {
|
||||
"vue": {
|
||||
"src": "../../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
|
||||
"file": "vue.js",
|
||||
"fileHash": "9f6650f2",
|
||||
"fileHash": "7cf78117",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vue/devtools-api": {
|
||||
"src": "../../../../node_modules/@vue/devtools-api/dist/index.js",
|
||||
"file": "vitepress___@vue_devtools-api.js",
|
||||
"fileHash": "87d887f1",
|
||||
"fileHash": "98f5c738",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vueuse/core": {
|
||||
"src": "../../../../node_modules/@vueuse/core/index.mjs",
|
||||
"file": "vitepress___@vueuse_core.js",
|
||||
"fileHash": "3179a954",
|
||||
"fileHash": "2d266902",
|
||||
"needsInterop": false
|
||||
},
|
||||
"@theme/index": {
|
||||
"src": "../../../../node_modules/vitepress/dist/client/theme-default/index.js",
|
||||
"file": "@theme_index.js",
|
||||
"fileHash": "1bd77338",
|
||||
"fileHash": "2eb1f2ce",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -17,6 +17,7 @@ export default {
|
||||
"/aws/": require("../aws/sidebar.json"),
|
||||
"/go": require("../go/sidebar.json"),
|
||||
"/react": require("../react/sidebar.json"),
|
||||
"/java": require("../java/sidebar.json"),
|
||||
"/": [
|
||||
{
|
||||
text: "Home",
|
||||
|
||||
0
docs/go/advanced/grpc.md
Normal file
0
docs/go/advanced/grpc.md
Normal file
0
docs/go/advanced/rpc.md
Normal file
0
docs/go/advanced/rpc.md
Normal file
@@ -15,6 +15,10 @@
|
||||
},
|
||||
{
|
||||
"text": "Go Advanced",
|
||||
"items": [{ "text": "Testing", "link": "/go/advanced/testing" }]
|
||||
"items": [
|
||||
{ "text": "Testing", "link": "/go/advanced/testing" },
|
||||
{"text": "RPC", "link": "/go/advanced/rpc"},
|
||||
{"text": "gRPC", "link": "/go/advanced/grpc"}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
1
docs/java/index.md
Normal file
1
docs/java/index.md
Normal file
@@ -0,0 +1 @@
|
||||
# Java
|
||||
9
docs/java/sidebar.json
Normal file
9
docs/java/sidebar.json
Normal file
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"text": "Basics",
|
||||
"items": [
|
||||
{ "text": "Introduction", "link": "/java/" }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,3 +5,5 @@
|
||||
[Rust](/rust/)
|
||||
|
||||
[Go](/go/)
|
||||
|
||||
[Java](/java/)
|
||||
27
docs/python/advanced/webscraping.md
Normal file
27
docs/python/advanced/webscraping.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Webscraping
|
||||
|
||||
Python is an amazing language to use for webscraping purposes. One of the ways to do this is with the BeautifulSoup (or bs4) package.
|
||||
|
||||
```python
|
||||
import requests
|
||||
import bs4
|
||||
|
||||
result = requests.get('https://en.wikipedia.org/wiki/Jonas_Salk')
|
||||
|
||||
soup = bs4.BeautifulSoup(result.text,"lxml")
|
||||
|
||||
print(soup.select('title')[0].getText())
|
||||
# soup.select('.some_class')
|
||||
# soup.select('#some_id')
|
||||
|
||||
# Images
|
||||
pic_element = soup.select('.thumbimage')[0]
|
||||
print(pic_element['src'])
|
||||
|
||||
image_link = requests.get('http:' + pic_element['src'])
|
||||
|
||||
# Write image to file
|
||||
f = open('my_img.jpg', 'wb')
|
||||
f.write(image_link.content)
|
||||
f.close()
|
||||
```
|
||||
@@ -25,6 +25,7 @@
|
||||
{"text": "Regex", "link": "/python/advanced/regex"},
|
||||
{"text": "Testing", "link": "/python/advanced/tests"},
|
||||
{"text": "Timing", "link": "/python/advanced/timing"},
|
||||
{"text": "Webscraping", "link": "/python/advanced/webscraping"},
|
||||
{"text": "Zipping", "link": "/python/advanced/zip"}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,6 +7,11 @@ Test functions are defined with the `#[test]` attribute. Within the tests, we u
|
||||
For unit tests, its best to write your tests in the file that it is testing but contain it with a `mod tests` with the `cfg(test)` attribute. This will exclude it from the final executable or library. Unit tests also allow you to test private functions, meaning ones that are not `pub`.
|
||||
|
||||
```rust
|
||||
#[allow(dead_code)]
|
||||
pub fn greeting(_name: &str) -> String {
|
||||
String::from("Hello!")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*; // Use this to call functions in the current file
|
||||
@@ -33,7 +38,31 @@ mod tests {
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn greater_than_100() {
|
||||
// Something illegal
|
||||
panic!("I'm supposed to panic")
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Expected text")]
|
||||
fn expect_panic_message() {
|
||||
panic!("Expected text");
|
||||
}
|
||||
|
||||
// Ignore test
|
||||
// Can still be run on demand
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn expensive_test() {
|
||||
// code that takes an hour to run
|
||||
}
|
||||
|
||||
// Return a result to allow for the ? operator to be used to cause test failures
|
||||
#[test]
|
||||
fn result_test() -> Result<(), String> {
|
||||
if 2 + 2 == 4 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(String::from("two plus two does not equal four"))
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -91,7 +91,7 @@ fn some_function<T, U>(t: &T, u: &U) -> i32
|
||||
|
||||
## Returning types that implement traits
|
||||
|
||||
You can only use a trait as a return value if you are returning a single type.
|
||||
You can only use a trait as a return value if you are returning a single type. For example, you can not have one path that returns a NewsArticle and one that returns a Tweet.
|
||||
|
||||
```rust
|
||||
fn returns_summarizable() -> impl Summary {
|
||||
|
||||
@@ -17,8 +17,11 @@ if num < 3 {
|
||||
|
||||
```rust
|
||||
let config_max = Some(3u8);
|
||||
let age: Result<u8, _> = "34".parse();
|
||||
if let Some(max) = config_max {
|
||||
println!("The maximum is configured to be {}", max);
|
||||
} else if let Ok(age) = age {
|
||||
println!("Age is {}", age);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -107,10 +110,25 @@ fn value_in_cents(coin: Coin) -> u8 {
|
||||
}
|
||||
|
||||
fn plus_one(x: Option<i32>) -> Option<i32> {
|
||||
match x {
|
||||
None => None,
|
||||
Some(i) => Some(i + 1),
|
||||
}
|
||||
match x {
|
||||
None => None,
|
||||
Some(i) => Some(i + 1),
|
||||
}
|
||||
}
|
||||
|
||||
// Or
|
||||
let x = 1;
|
||||
match x {
|
||||
1 | 2 => println!("one or two"),
|
||||
3 => println!("three"),
|
||||
_ => println!("anything"),
|
||||
}
|
||||
|
||||
// Range
|
||||
let x = 5;
|
||||
match x {
|
||||
1..=5 => println!("one through five"),
|
||||
_ => println!("something else"),
|
||||
}
|
||||
|
||||
```
|
||||
@@ -82,6 +82,21 @@ let _two = b[1];
|
||||
// let n = a[10];
|
||||
```
|
||||
|
||||
## Result
|
||||
|
||||
Results allow you to handle when something returns either a value or error. If it has a valid value, it will be of type `Ok<T>`, otherwise it will be of type `Err<E>`. See the `errors` section for more into on Results.
|
||||
|
||||
## Option
|
||||
|
||||
Options are similar to Results in that they can contain a conditional type. It can be either of type `None` or type `Some<T>`.
|
||||
|
||||
```rust
|
||||
enum Option<T> {
|
||||
None,
|
||||
Some(T),
|
||||
}
|
||||
```
|
||||
|
||||
## Type Aliases
|
||||
|
||||
```rust
|
||||
|
||||
Reference in New Issue
Block a user