This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
export XCURSOR_SIZE=24 | |
export QT_QPA_PLATFORMTHEME=qt5ct # change to qt6ct if you have that | |
export ELECTRON_OZONE_PLATFORM_HINT=auto | |
export GDK_BACKEND=wayland,x11 | |
export SDL_VIDEODRIVER=wayland | |
export CLUTTER_BACKEND=wayland | |
export MOZ_ENABLE_WAYLAND=1 | |
export MOZ_DISABLE_RDD_SANDBOX=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glyphBit(const FT_GlyphSlot &glyph, const int x, const int y) | |
{ | |
int pitch = abs(glyph->bitmap.pitch); | |
unsigned char *row = &glyph->bitmap.buffer[pitch * y]; | |
char cValue = row[x >> 3]; | |
return (cValue & (128 >> (x & 7))) != 0; | |
} | |
// When update() is called, we scan through each character and look in the m_glyph_images map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Quad { | |
sf::Vertex &a; | |
sf::Vertex &b; | |
sf::Vertex &c; | |
sf::Vertex &d; | |
}; | |
inline Quad & | |
getQuadForScreenLocation(sf::Vector2i location) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline bool | |
glyphBit(const FT_GlyphSlot &glyph, const int x, const int y) | |
{ | |
int pitch = abs(glyph->bitmap.pitch); | |
unsigned char *row = &glyph->bitmap.buffer[pitch * y]; | |
char cValue = row[x >> 3]; | |
return (cValue & (128 >> (x & 7))) != 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Win32", | |
"includePath": [ | |
"${workspaceFolder}/**", | |
"${vcpkgRoot}/x64-windows/include", | |
"${vcpkgRoot}/x64-windows-static/include", | |
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/include" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn compileShader(file: var, shader_type: c_uint) !c.GLuint { | |
std.debug.warn("shader loading file: {}\n", .{file}); | |
const source = try std.fs.cwd().readFileAlloc(std.heap.c_allocator, file, 1000000); | |
defer std.heap.c_allocator.free(source); | |
var shader = c.glCreateShader(shader_type); | |
c.glShaderSource(shader, 1, &(&source[0]), null); | |
c.glCompileShader(shader); | |
// check for shader compile errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const c = @import("c.zig"); | |
const vertexShaderSource = | |
\\#version 330 core | |
\\layout (location = 0) in vec3 aPos; | |
\\void main() | |
\\{ | |
\\ gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0); | |
\\} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CMakeLists.txt | |
cmake_minimum_required(VERSION 3.16) | |
# install vcpkg into /usr/local/vcpkg or some other path; you just need to point to it. | |
# hardcode the path in the CMakeLists.txt because I'm a peasant. | |
set(CMAKE_TOOLCHAIN_FILE "/usr/local/vcpkg/scripts/buildsystems/vcpkg.cmake") | |
project(testapp | |
VERSION 0.1 | |
DESCRIPTION "test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <random> | |
#include <iostream> | |
#define BUCKETS 100 | |
#define ITERATIONS 100000 | |
int main() | |
{ | |
uint64_t buckets[BUCKETS] = {0}; | |
std::mt19937_64 rand(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model | |
import ( | |
"github.com/jinzhu/gorm" | |
_ "github.com/jinzhu/gorm/dialects/mysql" | |
) | |
// this is shared by all goroutines accessing the database. Note it is NOT | |
// exported as any database access code should be in this package. This creates | |
// clean separation of concerns. |
NewerOlder