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
module Files | |
( getFilesRecursively | |
) where | |
import System.Directory (doesDirectoryExist, doesFileExist, listDirectory) | |
import System.Exit | |
import System.FilePath (combine) | |
data PathType = Directory | File | Invalid | |
deriving (Eq, Ord, Show, Enum) |
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
fn main() { | |
let rust = String::from("🦀 is 🔥"); | |
let split_crab = &rust[1..]; | |
println!("{}", split_crab); | |
} |
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
$cargo run | |
Compiling slice_test v0.1.0 (file:///Users/cbzehner/Projects/rust/slice_test) | |
Finished dev [unoptimized + debuginfo] target(s) in 0.71 secs | |
Running `target/debug/slice_test` | |
thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside '🦀' (bytes 0..4) of `🦀 is 🔥`', src/libcore/str/mod.rs:2234:5 | |
note: Run with `RUST_BACKTRACE=1` for a backtrace. |
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
fn largest<T: PartialOrd>(list: &[T]) -> &T { | |
let mut largest = &list[0]; | |
for ref item in list.iter() { | |
if *item > largest { | |
largest = item; | |
} | |
} | |
largest |
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
fn main() { | |
let r = 2; | |
{ | |
let x = 5; | |
let r = x; | |
} | |
println!("r: {}", r); | |
} |
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
cbzehner at MacBook-Pro-4 ~/Projects/pull-requests/rust/exercises/gigasecond [SUCCESS] | |
$cargo check | |
Compiling gigasecond v1.1.0 (file:///Users/cbzehner/Projects/pull-requests/rust/exercises/gigasecond) | |
error[E0412]: cannot find type `Utc` in this scope | |
--> src/lib.rs:6:30 | |
| | |
6 | pub fn after(start: DateTime<Utc>) -> DateTime<Utc> { | |
| ^^^ not found in this scope | |
help: possible candidates are found in other modules, you can import them into scope | |
| |
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
cbzehner at MacBook-Pro-4 ~/Projects/pull-requests/rust/exercises/nth-prime [SUCCESS] | |
$cargo test | |
Compiling nth_prime v1.0.0 (file:///Users/cbzehner/Projects/pull-requests/rust/exercises/nth-prime) | |
Finished dev [unoptimized + debuginfo] target(s) in 0.81 secs | |
Running target/debug/deps/nth_prime-94d2e6fce3eb8601 | |
running 0 tests | |
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out |
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
SELECT | |
name as full_name, | |
dob as birthday, | |
job as profession, | |
loc as office, | |
role as title | |
FROM employees | |
WHERE | |
profession LIKE '%ngineer%' | |
AND loc IN ['Fremont', 'San Francisco', 'Sunnyvale'] |
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
cbzehner at MacBook-Pro-4 ~/projects[SUCCESS] | |
$npm i -g wt-cli | |
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) | |
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue | |
/usr/local/bin/wt-cli -> /usr/local/lib/node_modules/wt-cli/bin/wt | |
/usr/local/bin/wt -> /usr/local/lib/node_modules/wt-cli/bin/wt | |
/usr/local/bin/auth0 -> /usr/local/lib/node_modules/wt-cli/bin/auth0 | |
> [email protected] install /usr/local/lib/node_modules/wt-cli/node_modules/fsevents | |
> node install |
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
/// Sorts a slice in-place-ish with mergesort. | |
/// Time Complexity: O(n * log(n)) | |
/// Space Complexity: O(n) | |
/// | |
/// ``` | |
/// use merge_sort::merge_sort; | |
/// | |
/// let mut example = [1,4,2,5,3]; | |
/// | |
/// merge_sort(&mut example); |
OlderNewer