Skip to content

Instantly share code, notes, and snippets.

use std::ops::Range;
use rangemap::RangeSet;
trait RangeExt {
fn add(&self, offset: i64) -> Self;
}
impl RangeExt for Range<i64> {
fn add(&self, offset: i64) -> Self {
@anden3
anden3 / holobot-config-schema.json
Created September 30, 2021 22:03
JSON Schema for HoloBot Configuration
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "HoloBot Configuration Schema",
"description": "Schema for the configuration of https://github.com/anden3/holo-bot.",
"x-taplo-info": {
"authors": ["anden3 (https://github.com/anden3)"],
"version": "0.1.0",
"patterns": [".*holobot.toml$"]
},
"type": "object",
@anden3
anden3 / createHouse2.js
Created January 3, 2018 22:49
CreateHouse2
function createHouse2() {
const vertices = [
[-10, -5, 10], // 0
[10, -5, 10], // 1
[-10, 5, 10], // 2
[10, 5, 10], // 3
[0, 15, 10], // 4
[-10, -5, -10], // 5
[-10, 5, -10], // 6
[0, 15, -10], // 7
@anden3
anden3 / drawStuff.js
Created January 3, 2018 22:32
DrawStuff
var world = shared.worldMatrix;
mat4.identity(world);
mat4.translate(world, world, vec3.fromValues(0, -20, 0));
setWorldViewProjection();
// Square
{
@anden3
anden3 / createHouse.js
Created January 3, 2018 15:03
CreateHouse
function createHouse() {
const vertices = [
// Front side wall.
[-10, -5, 10], [10, -5, 10], [-10, 5, 10],
[10, -5, 10], [10, 5, 10], [-10, 5, 10],
// Front side roof.
[-10, 5, 10], [10, 5, 10], [0, 15, 10],
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/serverData.cpp:199:104: error: ambiguous conversion for static_cast from 'dataType::Direction3D' to 'dataType::AngleDegrees'
diag << TS_INDENT << TS_INDENT << TS_INDENT << TS_INDENT << "VIEW: " << static_cast<float>(static_cast<AngleDegrees>(cData->getViewDirection())) << "\n";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./datatypes.hpp:60:11: note: candidate is the implicit move constructor
class AngleDegrees {
^
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./datatypes.hpp:60:11: note: candidate is the implicit copy constructor
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./datatypes.hpp:65:19: note: candidate constructor
constexpr AngleDegrees(const AngleRadians& other) : angle(other.angle * (180 / M_PI_FLOAT)) {};
#include <cstdio>
#include <stdexcept>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <CoreFoundation/CoreFoundation.h>
#include <signal.h>
#include <stdarg.h>
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./settings.hpp:148:10: error: explicit specialization of 'set' in class scope
void set(Setting key, const std::string& value) {
^
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./settings.hpp:198:9: error: chosen constructor is explicit in copy-initialization
Settings(EnumDefault)
^~~~~~~~~~~~~~~~~~~~~
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./settings.hpp:26:50: note: expanded from macro 'Settings'
XX(tangentReleaseDelay, static_cast<float>(0.f))
^
/Users/mac/Documents/C++/task-force-arma-3-radio/ts/src/./settings.hpp:30:26: note: expanded from macro 'EnumDefault'
Prekompilering:
Fixar "#"
Tar bort kommentarer
Löser ut makron
Makron har vi inte gått igenom
Copy-pastar include-filer
Kompilering:
Sourcefil (.cpp) blir objektfil (.obj)
Görs om till maskinkod
#include <fstream>
using namespace std;
int main() {
ifstream input1("input1.txt"); // in fstream, läser ett textdokument
ifstream input2("input2.txt");
ofstream output("output.txt"); // out fstream, skapar och öppnar ett textdokument
while (!(input1.eof() || input2.eof())) {