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
#![cfg_attr(not(test), no_std)] | |
#![cfg_attr(not(test), no_main)] | |
#[cfg(not(test))] | |
extern crate alloc; | |
#[cfg(not(test))] | |
type Vec<T> = alloc::vec::Vec<T>; | |
#[cfg(not(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
local num_verts = 100000 | |
local vertices = {} | |
for i=1,num_verts do | |
vertices[i] = {0, 0, 0, 0, 255, 255, 255, 255} | |
end | |
local ffi = require('ffi') | |
ffi.cdef[[ | |
typedef struct { | |
float x, y; |
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
local Set = {} | |
function Set.new() | |
local reverse = {} | |
local set = {} | |
return setmetatable(set, { | |
__index = { | |
insert = function(set, value) | |
if not reverse[value] then | |
table.insert(set, value) |
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
modules['subredditLinker'] = { | |
moduleID: 'subredditLinker', | |
moduleName: 'Subreddit Linker', | |
options: { }, | |
description: 'Finds any subreddit mentions that are not links and converts them into links.', | |
isEnabled: function() { | |
return RESConsole.getModulePrefs(this.moduleID); | |
}, | |
include: Array( | |
/https?:\/\/([a-z]+).reddit.com\/user\/[-\w\.]+/i, |
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 <cstdio> | |
class UnaryTest { | |
public: | |
static const UnaryTest STATIC_TEST; | |
double p; | |
UnaryTest(double p); | |
}; |
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
import org.jibble.pircbot.*; | |
import java.io.*; | |
import java.util.Scanner; | |
import java.util.ArrayList; | |
import java.util.Random; | |
public class Bot extends PircBot { | |
public final String PARENT = "C:\\Documents and Settings\\Tanner Rogalsky\\My Documents\\RPS\\users"; | |
public String mainChannel; |
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
template<int32_t N> | |
void buffer(GLuint *vbos) { | |
if constexpr(N >= 0) { | |
const auto vertices = subdivide<N>(indexedVertices, indices); | |
const auto wireframe = getWireframeGeometry(vertices); | |
glBindBuffer(GL_ARRAY_BUFFER, vbos[N]); | |
glBufferData(GL_ARRAY_BUFFER, wireframe.size() * sizeof(Vertex), wireframe.data(), GL_STATIC_DRAW); | |
buffer<N - 1>(vbos); | |
} | |
} |
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
local _PACKAGE = (...):match("^(.+)[%./][^%.]+") | |
local Line = {} | |
Line.__index = Line | |
local Vector = require(_PACKAGE .. ".vector") | |
function Line.new(x1, y1, x2, y2) | |
local self = setmetatable({}, Line) | |
self.origin = Vector(x1, y1) |
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
local function insertVertices(vertices, vert, ...) | |
if vert then | |
table.insert(vertices, vert) | |
insertVertices(vertices, ...) | |
end | |
end | |
local function createSphereVertex(radius, theta, phi, ox, oy) | |
local xb = math.cos(phi) * math.cos(theta) | |
local yb = math.sin(theta) |
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
local function genMesh(num_verts, radius) | |
local verts = {} | |
local interval = math.pi * 2 / num_verts | |
for i=1,num_verts do | |
local phi = i * interval | |
local x = radius * math.cos(phi) | |
local y = radius * math.sin(phi) | |
local u = (x + radius) / (radius * 2) | |
local v = (y + radius) / (radius * 2) | |
table.insert(verts, {x, y, u, v}) |
NewerOlder