Skip to content

Instantly share code, notes, and snippets.

View djg's full-sized avatar
💭
I may be slow to respond.

Dan Glastonbury djg

💭
I may be slow to respond.
View GitHub Profile
@djg
djg / reading-list.md
Last active February 19, 2024 18:09
Fabian's Recommened Reading List
@djg
djg / 0001-Fix-compilation-on-osx-with-cmake.patch
Created May 18, 2017 01:00
OpenSCAD: Fix compilation on OSX with cmake
From 518dd61cfbdcaa4c8815f15ae484552125134d4b Mon Sep 17 00:00:00 2001
From: Dan Glastonbury <dglastonbury@mozilla.com>
Date: Thu, 18 May 2017 10:14:47 +1000
Subject: [PATCH] Fix compilation on osx with cmake.
---
CMakeLists.txt | 7 ++++++-
cmake/Modules/FindQt5QScintilla.cmake | 2 +-
src/AboutDialog.cc | 9 +++++++++
src/AboutDialog.h | 8 +-------
@djg
djg / tmp.rs
Created March 23, 2017 07:33
Static & Dynamic FFI functions
// This code is generated by fuxor. (https://github.com/djg/fuxor)
use libc::{{c_char,c_void}};
use libc::{{dlclose,dlopen,dlsym,RTLD_LAZY}};
macro_rules! cstr {{
($x:expr) => { concat!($x, "\0").as_bytes().as_ptr() as *const c_char }}
}}
extern "C" {
@djg
djg / gist:993d413decd7860259466fed386cee21
Created August 18, 2016 08:35
Learning how to pinmap...
__asm
{
mov eax,srctex
mov edx,dest
pushad
mov esi,offset pin
mov edi,edx
mov pintexptr,eax
@djg
djg / intel-hd-4600.txt
Created July 15, 2016 04:33
Intel(R) HD Graphics 4600
Intel(R) HD Graphics 4600
Report Date: Friday, July 15, 2016
Report Time [hh:mm:ss]: 2:30:59 PM
Driver Version: 10.18.15.4279
Operating System: Windows* 10 Pro(10.0.14372)
Default Language: English (Australia)
# YCBCR422
diff --git a/gfx/2d/MacIOSurface.cpp b/gfx/2d/MacIOSurface.cpp
index 4ac0a50..8231d8a 100644
--- a/gfx/2d/MacIOSurface.cpp
+++ b/gfx/2d/MacIOSurface.cpp
@@ -476,6 +476,8 @@ MacIOSurface::GetFormat()
OSType pixelFormat = GetPixelFormat();
if (pixelFormat == '420v') {
return SurfaceFormat::NV12;
+ } else if (pixelFormat == '2vuy') {
@djg
djg / gist:05323539d0894dd9119c
Created February 18, 2016 01:29
nsDocument: IsActive() vs. IsVisible() vs. Hidden()
<roc> basically, IsActive() is true when the document is associated with a GlobalWindow(inner) which is the current document in its docshell
<roc> i.e. not bfcached
<roc> IsVisible() is similar but more specifically delimited by the pageshow and pagehide DOM events
<roc> Hidden() is like !IsActive() but all documents associated with hidden tabs are also Hdden()
<roc> tabs/docshells have this "hidden" state; all Firefox tabs that aren't the topmost tab are marked hidden
@djg
djg / gist:572eb0acc7c7c9667493
Created May 21, 2015 01:25
glBindBufferRange
GLuint buf;
glGenBuffers(1, &buf);
// glBindBuffer(GL_UNIFORM, buf); <-- OSX needs this or ...
glBindBufferRange(GL_UNIFORM_BUFFER, 0, buf, 0, 4); // ... this returns GL_INVALID_VALUE
@djg
djg / gist:7140c17b7f1fa8e8110e
Created April 13, 2015 06:53
That doesn't seem right...
$ ninja && ./xfb
[2/2] clang++ xfb.o deRandom.o gl3w.o -o xfb -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
glDrawArrays(0x0000, 0, 64)
pauseTransformFeedback
glDrawArrays(0x0000, 64, 64)
resumeTransformFeedback
glDrawArrays(0x0000, 128, 64)
GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 64
@djg
djg / djg.el
Last active August 29, 2015 14:02
;; I'm always opening a buffer in the wrong window. These function
;; help move the newly opened buffer to another window and restore the
;; buffer I was previously looking at.
(defun djg/buf-move (dir errmsg)
(let* ((other-win (windmove-find-other-window dir))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error errmsg)
(set-window-buffer other-win buf-this-buf)
(switch-to-prev-buffer))))