Skip to content

Instantly share code, notes, and snippets.

View warmist's full-sized avatar
💭
Making a game or sth

Warmist warmist

💭
Making a game or sth
View GitHub Profile
@jdkanani
jdkanani / notepad.html
Last active April 6, 2024 17:09 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@imneme
imneme / randutils.hpp
Last active March 28, 2024 20:43
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Melissa E. O'Neill
*
@d7samurai
d7samurai / .readme.md
Last active March 27, 2024 17:50
Minimal D3D11 pt2

Minimal D3D11 pt2

Follow-up to Minimal D3D11, adding instanced rendering. As before: An uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft.

The main difference here is that the hollow cube is rendered using DrawIndexedInstanced (which saves a lot of vertices compared to the original, so model data is now small enough to be included in the source without being too much in the way), but also all trigonometry and matrix math is moved to the vertex shader, further simplifying the main code.

Each instance is merely this piece of geometry, consisting of 4 triangles:

instanced1

..which is th

@mmozeiko
mmozeiko / win32_crt_float.cpp
Last active February 16, 2024 14:24
Visual C/C++ CRT functionality
extern "C"
{
int _fltused;
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture
__declspec(naked) void _ftol2()
{
__asm
{
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@beesandbombs
beesandbombs / starTorus.pde
Created September 5, 2018 22:57
star torus
// "star torus" by davey
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@ksmithdev
ksmithdev / Coin.scad
Created May 29, 2023 20:18
Used to create a standing coin with sides
$fn=10;
union() {
difference() {
cylinder(h=4, r=12.5, center=false);
cylinder(h=1, r=10.5, center=false);
translate([0,0,3])
cylinder(h=1, r=10.5, center=false);
}
@ksmithdev
ksmithdev / relief_generator.scad
Created May 29, 2023 20:16
Used to generate an STL coin face
layer_height = 0.2;
model_height = 1;
union() {
for (i=[0:layer_height:model_height]) {
translate([0,0,i])
linear_extrude(layer_height)
offset(-i*0.6)
resize([10,10,layer_height])
import("Symbol.svg", center = true);
@aras-p
aras-p / test.txt
Last active November 2, 2022 23:26
Markdeep Admonition style blocks?
Right now I can do this in Markdeep source:
------------------
Just a test paragraph, move along...
<div class="note">
Just a note. Don't mind me.
</div>
<div class="warn">