Compare commits

..

No commits in common. "5eccbfcbfcf1695e709efafa9f91aa1111c2ad6e" and "6d675d03b484b19d89cf44e555bcc05f4a37475e" have entirely different histories.

8 changed files with 50 additions and 81 deletions

View File

@ -1,13 +1,10 @@
// skeleton.cpp
#include <iostream>
#include <map>
#include <memory>
class Person
{
std::string name;
std::map<std::string, std::string> attributes {};
public:
@ -16,31 +13,17 @@ class Person
this->name = name;
}
Person* addAttribute(std::string key, std::string value)
{
this->attributes[key] = value;
return this;
}
void greet()
{
std::cout << "Hello, my name is " << this->name << "!" << std::endl;
for (auto& kv : this->attributes) {
std::cout << " My " << kv.first << " is " << kv.second << "." << std::endl;
}
}
};
int main(int argc, char* argv[])
{
auto person = std::unique_ptr<Person>((new Person("Madison"))
->addAttribute("best friend", "Bob")
->addAttribute("favorite color", "pink")
);
auto person = new Person("Madison");
person->greet();
// Not necessary with unique_ptr:
// delete person;
delete person;
return 0;
}

View File

@ -1,60 +0,0 @@
<?php
echo '<!DOCTYPE html>';
echo '<html lang="en">';
echo '<!-- This is a simple PHP template -->';
// This section could also use <?= syntax, but for example's sake, will not.
?>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= ucfirst(basename(__FILE__, '.php')) ?></title>
<link rel="stylesheet" href="css/style.css">
<meta name="description" content="">
<meta property="og:title" content="">
<meta property="og:type" content="">
<meta property="og:url" content="">
<meta property="og:image" content="">
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="icon.png">
<link rel="manifest" href="site.webmanifest">
<meta name="theme-color" content="#fafafa">
</head>
<body>
<h1>Hello world!</h1>
<p><?= "This page was rendered on " . date("Y-m-d") ?></p>
<pre><?php
$pairs = [
"hello" => "world!",
"how are" => "you?",
"i like the number" => 3
];
// Iterate over key-value pairs
foreach ($pairs as $k => $v) {
echo "($k, $v) ";
}
echo "\n\n";
// Iterate over keys
foreach (array_keys($pairs) as $key) {
echo "$key: $pairs[$key]\n";
}
echo "\n";
// Iterate over values
foreach ($pairs as $value) {
echo "values = $value\n";
}
?>
</pre>
</body>
</html>

View File

@ -165,7 +165,6 @@ if has ("autocmd")
autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py
autocmd BufNewFile *.rb 0r ~/.vim/templates/skeleton.rb
autocmd BufNewFile *.lua 0r ~/.vim/templates/skeleton.lua
autocmd BufNewFile *.php 0r ~/.vim/templates/skeleton.php
autocmd BufNewFile *.md 0r ~/.vim/templates/skeleton.md
autocmd BufNewFile *.html 0r ~/.vim/templates/skeleton.html
autocmd BufNewFile *.java 0r ~/.vim/templates/skeleton.java

View File

@ -0,0 +1,9 @@
CC=gcc
CFLAGS=-I.
MAIN=hello
nonnull: $(MAIN).o
$(CC) -o $(MAIN) $(MAIN).o
clean:
rm ./*.o

View File

@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
printf("Hello, world!\n");
}

View File

@ -0,0 +1,7 @@
#include <iostream>
using namespace std;
int main() {
cout << "Hello, world!" << endl;
}

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<title>Wow, the title of the new website</title>
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#242627">
<meta name="msapplication-TileColor" content="#224679">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="This should be a lovely new description">
</head>
<body>
<h1>Hello, world!</h1>
<p>This is the beginning of a beautiful new website.</p>
</body>
</html>

View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "Hello, world!"