A decent report preamble, fit for programming-related topics.
Big thanks to #latex on Freenode and various tex.stackexchange.com threads for the help.
Dependencies that aren't LaTeX packages:
| while (!(cin >> x)) { | |
| cout << "error: something went wrong!" // alert user | |
| cin.clear(); | |
| cin.ignore(1000, '\n'); // discard non-type (if x is a specific type) value in input buffer | |
| } |
| using namespace std; | |
| int reused = 42; // global scope | |
| int main() | |
| { | |
| int unique = 0; // block/local scope | |
| // output #1: uses global reused; prints "42 0" | |
| cout << reused << " " << unique << endl; | |
| int reused = 0; // new, local name, hides (currently overrides?) global name | |
| // output #2: uses local reused; prints "0 0" |
| int i = 1024, i2 = 2048; // i and i2 are both ints | |
| int &r = i, r2 = i2; // r is a reference bound to i; r2 is an int | |
| int i3 = 1024, &ri = i3; // i3 is and int; ri i a reference bound to i3 | |
| int &r3 = i3, &r4 = i2; // both r3 and r4 are references | |
| int &refVal4 = 10; // error: initializer must be an object | |
| double dval = 3.14; | |
| int &refVal4 = dval; // error: initiazlier must be an int object |
| { | |
| "cmd": ["g++", "${file}", "-std=c++0x", "-o", "${file_path}/${file_base_name}"], | |
| "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
| "working_dir": "${file_path}", | |
| "selector": "source.c, source.c++", | |
| "variants": | |
| [ | |
| { | |
| "name": "Run", |
| \documentclass[12pt]{article} | |
| \usepackage[margin = 1in]{geometry} | |
| \usepackage[T1]{fontenc} | |
| \usepackage{libertine} | |
| \usepackage[utf8]{inputenc} | |
| \usepackage[<lang>]{babel} | |
| \usepackage{fancyhdr} | |
| \setlength{\headheight}{15pt} % for better header hight thing, removes LaTeX error | |
| \pagestyle{fancy} |
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| int main(int argc, char *argv[]) | |
| { | |
| if (argc < 2) return 1; |
| #!/bin/sh | |
| WALLPATH_BIG=/home/tmplt/.wallpapers/big/ | |
| WALLPATH_SMALL=/home/tmplt/.wallpapers/small/ | |
| while true; do | |
| # Choose a random wallpaper for the big screen | |
| WP_BIG=$(find $WALLPATH_BIG -type f \( -name '*.jpg' -o -name '*.png' \) -print0 | | |
| shuf -n1 -z) | |
A decent report preamble, fit for programming-related topics.
Big thanks to #latex on Freenode and various tex.stackexchange.com threads for the help.
Dependencies that aren't LaTeX packages:
When working on fuzzywuzzy I required a C++ implementation of the Levenshtein edit distance. I found different ways to implement this, so I took a bit of everything, and tried to simplify it as much as I could.
Majority of credit goes to Martin Ettl, for his submission on Rosetta Code.
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
| 0.0 0 | |
| 0.0010420332355816227 0 | |
| 0.0020840664711632454 0 | |
| 0.003126099706744868 0 | |
| 0.004168132942326491 0 | |
| 0.005210166177908113 0 | |
| 0.006252199413489736 0 | |
| 0.007294232649071359 0 | |
| 0.008336265884652982 0 | |
| 0.009378299120234603 0 |