Skip to content

Instantly share code, notes, and snippets.

View effective_modern_cmake.md

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@serpent7776
serpent7776 / pointsPixels.m
Last active Mar 18, 2018
iOS - Points to pixels and Pixels to points conversion
View pointsPixels.m
- (CGFloat)pixelToPoints:(CGFloat)px {
CGFloat pointsPerInch = 72.0; // see: http://en.wikipedia.org/wiki/Point%5Fsize#Current%5FDTP%5Fpoint%5Fsystem
CGFloat scale = 1;
float pixelPerInch; // DPI
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
pixelPerInch = 132 * scale;
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
pixelPerInch = 163 * scale;
} else {
pixelPerInch = 160 * scale;
@serpent7776
serpent7776 / circular_buffer.lua
Last active Jul 12, 2017 — forked from johndgiese/circular_buffer.lua
Circular Buffer in Lua
View circular_buffer.lua
-- circular buffer factory for lua
local function rotate_indice(i, n)
return ((i - 1) % n) + 1
end
local circular_buffer = {}
function circular_buffer:filled()
return #(self.history) == self.max_length
View main.lua
function love.load()
screenWidth = love.graphics.getWidth()
screenHeight = love.graphics.getHeight()
canvas = love.graphics.newCanvas(screenWidth, screenHeight)
end
function love.draw(dt)
-- draw to canvas
love.graphics.setCanvas(canvas)
local w = screenWidth / 2
View main.lua
function love.load()
canvas = love.graphics.newCanvas(800, 600)
x = 400
y = 300
r = 10
vx = math.random() * 100
vy = math.random() * 100
end
function love.update(dt)