This file contains hidden or 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
| local timeTest = function(f, ...) | |
| local t1, r, t2 = os.clock(), f(...), os.clock() | |
| print(string.format("The function took %0.6f seconds to run", t2 - t1)) | |
| return r | |
| end | |
| return timeTest |
This file contains hidden or 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
| local parse = require "moonscript.parse" | |
| local compile = require "moonscript.compile" | |
| local function getLine(msg) | |
| io.write(msg or "> ") | |
| return io.read("*l") | |
| end | |
| local function getChoice(msg, ...) |
This file contains hidden or 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
| require("table-partition.lua") | |
| do -- Dividing a table with a length of 167 into 7 tables | |
| local TBL = {} | |
| for i = 1, 167 do TBL[i] = i end | |
| local TBLS = table.partition(TBL, 7) |
This file contains hidden or 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
| local lg = love.graphics | |
| local Display = { | |
| size = { | |
| w = 0, | |
| h = 0, | |
| ox = 0, | |
| oy = 0 | |
| }; |
This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools"> | |
| <uses-feature android:glEsVersion="0x00020000" android:required="true" /> | |
| <!-- Add this for apps targeting Android 13 or higher & GMA SDK version 20.3.0 or lower --> | |
| <uses-permission android:name="com.google.android.gms.permission.AD_ID"/> | |
| <application> |
This file contains hidden or 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
| local function formatString(inputString) | |
| local outputString = "" | |
| for line in inputString:gmatch("[^\r\n]+") do | |
| if line:match("%S") then -- Check if row is empty | |
| local formattedLine = line:gsub("^%s*", "") -- Remove spaces before the first character of the line |
This file contains hidden or 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
| // This code is distributed under the Unlicense license. | |
| // For more details, please visit https://unlicense.org/ | |
| template <class T> | |
| class CircularBuffer | |
| { | |
| private: | |
| std::unique_ptr<T[]> buffer; | |
| size_t frontIndex; | |
| size_t backIndex; |
This file contains hidden or 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
| // This code is distributed under the Unlicense license. | |
| // For more details, please visit https://unlicense.org/ | |
| #ifndef IDMAN_HPP | |
| #define IDMAN_HPP | |
| #include <type_traits> | |
| #include <set> | |
| /** |
This file contains hidden or 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 <raylib.h> | |
| #include <raymath.h> | |
| static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist) | |
| { | |
| // Calculate direction vector and distance between listener and sound source | |
| Vector3 direction = Vector3Subtract(position, listener.position); | |
| float distance = Vector3Length(direction); | |
| // Apply logarithmic distance attenuation and clamp between 0-1 |
This file contains hidden or 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
| #version 330 core | |
| noperspective in vec2 vTexCoord; | |
| uniform sampler2D uTexColor; | |
| out vec4 FragColor; | |
| float GradientNoise(in vec2 fragCoord) | |
| { | |
| // from: https://www.shadertoy.com/view/lfyBWK | |
| return fract(52.9829189 * fract(dot(fragCoord, vec2(0.06711056, 0.00583715)))); |
OlderNewer