Skip to content

Instantly share code, notes, and snippets.

@ocornut
ocornut / imgui_node_graph_test.cpp
Last active April 23, 2024 19:02
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().

[JULIA] Faster than CGAL Delaunay

TL;DR

DelaunayJL is an incremental 2D Delaunay triangulation algorithm implemented in Julia, it is robust and ~20% faster than CGAL, the C++ de-facto industry standard. And it's MIT Licensed! all links to code are below

Show me the data!

The figure below shows how much time it takes to run a benchmark on my computer, an Intel Core i7-4800MQ CPU @ 2.7Ghz, 16GB RAM, Win8 64bit. The benchmark consists of inserting a number of points uniformly distributed. The benchmark is run 5 times for each number of points once for CGAL and once for Julia. The numbers of points used are 10K, 100K, 1M, and 10M. CGAL v4.4 was compiled with VS2013 64bit release mode, Julia is of version 0.3.0 Commit 7681878 (2014-08-20 20:43 UTC) x86_64-w64-mingw32 the delaunay code is here (see other gists of mine for complementing files... I'll compile this all into a library when I have the time)

@drdrang
drdrang / Alpha Evaluate.py
Last active August 29, 2015 14:03
Evaluate an expression with a numerical answer using Wolfram Alpha and return the result as an equation. Also open the Alpha page in a browser (Mac only). Intended to be used as a BBEdit Text Filter but can be used from the command line. See http://www.leancrew.com/all-this/2014/07/evaluating-latex-with-eddie-and-alpha/
#!/usr/bin/python
from urllib import quote_plus
from sys import stdin
from subprocess import call
import requests
import xml.etree.ElementTree as ET
appID = 'XXXXXX-YYYYYYYYYY' # Placeholder. You'll need to get an ID from http://products.wolframalpha.com/api/
@andrejbauer
andrejbauer / topology.v
Last active November 28, 2023 19:40
How to get started with point-set topology in Coq. This is not actually how one would do it, but it is an intuitive setup for a classical mathematician.
(* How do to topology in Coq if you are secretly an HOL fan.
We will not use type classes or canonical structures because they
count as "advanced" technology. But we will use notations.
*)
(* We think of subsets as propositional functions.
Thus, if [A] is a type [x : A] and [U] is a subset of [A],
[U x] means "[x] is an element of [U]".
*)
Definition P (A : Type) := A -> Prop.
@aras-p
aras-p / lambda.cpp
Last active September 24, 2019 02:40
Lambda art
// C++11 lambdas aren't terribly useful at producing art.
// Source below is valid C++11. VS2013 takes about a minute at it (Release config),
// reaches almost 4GB of memory usage and then gives a
//
// 1>ConsoleApplication1.cpp(34): fatal error C1001: An internal error has occurred in the compiler.
// 1> (compiler file 'msc1.cpp', line 1325)
// 1> To work around this problem, try simplifying or changing the program near the locations listed above.
// 1> Please choose the Technical Support command on the Visual C++
// 1> Help menu, or open the Technical Support help file for more information
// 1> This error occurred in injected text:
@landonf
landonf / PLSuperInit.m
Last active December 11, 2015 11:48
Avoiding the default [super init] boilerplate:
/**
* @ingroup macros
*
* Call the superclass' default zero-argument initializer, returning nil if the superclass' initializer
* returns nil.
*
* This macro is equivalent to:
*
* @code
* if ((self = [super init]) == nil)
@BenedictC
BenedictC / gist:4246759
Created December 9, 2012 20:03
A marco for creating enums with values which can be logged (inspired by http://rentzsch.tumblr.com/post/37512716957/enum-nsstring and long train journey).
#define EMKStringableEnum(ENUM_NAME, ENUM_VALUES...) \
\
typedef enum { \
ENUM_VALUES \
} ENUM_NAME; \
\
\
\
static NSString * ENUM_NAME##ToString(int enumValue) { \
static NSString *enumDescription = @"" #ENUM_VALUES; \
@0xced
0xced / NSObject+ARCZombie.m
Created May 19, 2012 17:52
Solves the problem of .cxx_destruct methods not being called when zombies are enabled
#import <objc/runtime.h>
@implementation NSObject (ARCZombie)
+ (void) load
{
const char *NSZombieEnabled = getenv("NSZombieEnabled");
if (NSZombieEnabled && tolower(NSZombieEnabled[0]) == 'y')
{
Method dealloc = class_getInstanceMethod(self, @selector(dealloc));
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@cefstat
cefstat / lion-fullscreen.patch
Created November 10, 2011 19:31
Patch for Emacs fullscreen support under Mac OS X 10.7 (Lion)
=== modified file 'lisp/term/ns-win.el'
--- old/lisp/term/ns-win.el 2011-10-01 20:32:01 +0000
+++ new/lisp/term/ns-win.el 2011-11-10 16:22:51 +0000
@@ -928,6 +928,10 @@
(add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
+ (interactive)