Skip to content

Instantly share code, notes, and snippets.

View DewofyourYouth's full-sized avatar
:octocat:
Pluckin' banjo or crafting a tinfoil hat. Also, sometimes I code. ;)

Jacob E. Shore DewofyourYouth

:octocat:
Pluckin' banjo or crafting a tinfoil hat. Also, sometimes I code. ;)
  • Dew of your Youth
  • Bet Shemesh, Israel
View GitHub Profile
@DewofyourYouth
DewofyourYouth / ownership_and_slices.rs
Created February 7, 2021 08:32
Rust ownership and slices
fn main() {
{
// simple things like integers are copied b/c they are fixed in size
let x = 5;
let y = x;
println!("{} + {} = {}", x, y, x + y); // this works b/c ints are simple values with a known fixed size
// this is not true for things like strings.
let mut s = String::from("hello");
s.push_str(", world!");
println!("{}", s);
@DewofyourYouth
DewofyourYouth / ownership_basics.rs
Created February 6, 2021 19:44
The basics of ownership in Rust (from the rust book).
fn main() {
{
// simple things like integers are copied b/c they are fixed in size
let x = 5;
let y = x;
println!("{} + {} = {}", x, y, x + y); // this works b/c ints are simple values with a known fixed size
// this is not true for things like strings.
let mut s = String::from("hello");
s.push_str(", world!");
println!("{}", s);
@DewofyourYouth
DewofyourYouth / main.dart
Last active February 12, 2020 09:11
Basic Dart OOP
void main() {
Human jenny = Human(age: 32, firstName: "Jenny", lastName: "Swanson");
jenny.firstName = "Jenny";
jenny.talk("Hey, you're cute!");
Human paul = Human(age: 38, firstName: "Paul", lastName: "McGovern");
paul.talk("My name is Paul, what's yours?");
Car myFirstCar = Car();
myFirstCar.drive();
@DewofyourYouth
DewofyourYouth / index.html
Last active January 30, 2020 21:53
markdown parser (regex)
<!-- Still in progress. At this point it only parses headers and links - also, can't handle more than one link per line -->
<div id="app">
<h1>Markdown Parser</h1>
<span>Write markdown here:</span>
<textarea name="markdown-text" id="md-text" rows="7"> </textarea>
</div>
<span>Results appear here:</span>
<div id="result"></div>
@DewofyourYouth
DewofyourYouth / classy_dart.dart
Created January 7, 2020 18:57
some basic dart stuff
class Person {
String name;
int age;
/// A class for making people. Accepts a [name] and an [age]
Person(String name, int age) {
this.name = name;
this.age = age;
}
}
void main() {
print(tribonacciTime([0, 0, 1], 10));
print(find([1, 3, 4, 5, 7]));
print(find([2, 4, 5, 6]));
}
// Find the outlier
int find(List integers) {
var evens = 0;
for (int ctr = 0; ctr <= 2; ctr++) {
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://dewofyouryouth.github.io/">
<img src="https://dewofyouryouth.github.io/doyy.png" height="50">
</a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
@DewofyourYouth
DewofyourYouth / index.html
Created November 26, 2019 11:12
vue-todo-basic
<div class="wrap">
<div class="jumbotron">
<h1 class="display-2 text-center">Vue Todo</h1>
<h2 class="text-center"> -- Basic ---</h2>
</div>
</div>
<div id="app" class="container">
<h3 class="text-center">Instructions:</h3>
<p class="text-center">
const object1 = {
'50': 'somestring',
'100': 42,
'25': false
};
var numsArr = [1, 34, 68.5, 33];
// Returns an array of the keys - then maps then to get the values by key
// Example of function
String addNumbers(int num1, int num2){
return('${num1} + ${num2} = ${num1 + num2}');
}
// A basic class w/ attribute
class Person {
String fname;
String lname;
int age;