Skip to content

Instantly share code, notes, and snippets.

View LordAro's full-sized avatar

Charles Pigott LordAro

View GitHub Profile
try:
with open("foo.txt") as f:
for l in f:
print(l)
print("and some other stuff")
print("enough stuff that a list comprehension is unfeasible")
except EnvironmentError as e:
print(f"Oh no: {e}")
html {
background-color: #AB9C7D;
color: black;
font-family: "Trebuchet MS", Arial, Verdana, Sans-Serif;
font-size: 12px;
}
body {
width: 800px;
margin: auto auto;
with Ada.Text_IO;
procedure Learn is
type Integer_Array is array (Natural range <>) of Integer;
b : Integer_Array := (1,2,3);
a : Integer_Array := (4,5,6);
begin
if b(0..2) < a(1..2) then
Ada.Text_IO.Put_Line ("HELLO");
end if;
#include <iostream>
#include <type_traits>
#include <vector>
template<typename, typename = void>
struct is_std_container : std::false_type {};
template<typename T>
struct is_std_container<T,
[src/3rdparty/squirrel/squirrel/sqclass.h:10]: (performance) Variable 'val' is assigned in constructor body. Consider performing initialization in initialization list.
[src/3rdparty/squirrel/squirrel/sqclass.h:11]: (performance) Variable 'attrs' is assigned in constructor body. Consider performing initialization in initialization list.
[src/3rdparty/squirrel/squirrel/sqclosure.h:10]: (performance) Variable '_function' is assigned in constructor body. Consider performing initialization in initialization list.
[src/3rdparty/squirrel/squirrel/sqclosure.h:48]: (performance) Variable '_closure' is assigned in constructor body. Consider performing initialization in initialization list.
[src/3rdparty/squirrel/squirrel/sqcompiler.cpp:664]: (portability) Casting from float* to integer* is not portable due to different binary data representations on different platforms.
[src/3rdparty/squirrel/squirrel/sqcompiler.cpp:710]: (portability) Casting from float* to integer* is not portable due to different binary data represe
#include <stdio.h>
int main(void) {
int someValue = 1;
int x = 10, y = 10;
someValue ? ++x, ++y : --x, --y;
printf("%d %d\n", x, y);
return 0;
@LordAro
LordAro / soln.cpp
Last active October 12, 2017 08:17
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
template <int N>
int plus(int i)
{
return i + N;
122.42794036865ms
47.846794128418ms
226.38607025146ms
105.95703125ms
194.10586357117ms
60.943126678467ms
182.0080280304ms
174.10182952881ms
103.69205474854ms
44.697999954224ms
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file industry_cmd.cpp Handling of industry tiles. */
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 8fea6953a..4d1516cf0 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2461,39 +2461,30 @@ static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int
static const uint PERCENT_TRANSPORTED_60 = 153;
static const uint PERCENT_TRANSPORTED_80 = 204;
-/**
- * Change industry production or do closure