Skip to content

Instantly share code, notes, and snippets.

using Uno;
using Uno.Platform;
using Uno.Collections;
using Android;
using Android.Runtime;
using Android.android.os;
using Android.android.app;
using Android.android.content;
using Android.android.location;
@cbaggers
cbaggers / gist:96aadd1a3656b82ea1c1
Created November 11, 2014 19:13
jni/XGC.cpp:10:1: error: 'XGC' in 'class Xli::Array<Android::Runtime::JWrapper*>' does not name a type
//------header file -------//
#ifndef __XGC_ANDROID_HEADER__
#define __XGC_ANDROID_HEADER__
#include <${Android.Runtime.JWrapper:Include}>
#include <Xli/Mutex.h>
#include <Xli.h>
class XGC
@cbaggers
cbaggers / gist:dec902b72818f52318d1
Last active August 29, 2015 14:15
readmacro magic
;; Playing with reader macros over the weekend.
;; Example of reader and writer being mirroring each other beautifully
;;So we need a class for IP addresses
CL-USER> (defclass ip () ((address :initarg :address) (port :initarg :port)))
#<STANDARD-CLASS IP>
;; def-hashslash-reader is a macro I wrote to create reader macros.
;; In short this code:
@cbaggers
cbaggers / gist:f7c5bb87efe0fc692241
Created March 10, 2015 15:38
Render a triangle in common lisp using opengl
(in-package :cepl)
(defparameter *array* nil)
(defparameter *stream* nil)
(defparameter *running* nil)
(defstruct-g pos-col ()
(position :vec3 :accessor pos)
(color :vec4 :accessor col))
@cbaggers
cbaggers / gist:76b4fa06a35a48790639
Last active August 29, 2015 14:23
Possible enum issue in cl-opengl?
;; Goal find any enum in %gl:enum where where the following results in a notably
;; different symbol:
;; - take the keyword from %gl:enums
;; - use cffi:foreign-enum-value to convert it to a value
;; - use cffi:foreign-enum-keyword to turn the value back to a keyword
;;
;; Many enums return the ext version instead so I try to filter for enums that are
;; notably different
;; There are clearly some false positives here but also plenty I cannot explain
@cbaggers
cbaggers / gist:2eac188a69a649124412
Last active August 29, 2015 14:23
Paredit dont add space after pattern
// patterns
// (?a ?#) means no space after #a
// (?λ) means no space after λ
(defvar paredit-dont-add-space-after
'((?s ?#) (?a ?#) (?λ) (?- ?#) (?+ ?#) (?c ?#) (?o ?#) (?p ?#) (?r ?#) (?s ?#) (?x ?#)))
(add-hook 'paredit-mode-hook
(lambda ()
(setq paredit-space-for-delimiter-predicates
(list (lambda (endp delimiter)
@cbaggers
cbaggers / gist:3a0f6313bc9b567b07a4
Created June 26, 2015 21:04
Varjo now turns variables referenced inside nested funcs into implicit arguments
VARJO> (glsl-code
(defshader test ()
(let ((a 4) (b 20) (c 5))
(labels ((test ((x :int))
(labels ((moo () (+ c b)))
(* x a (moo)))))
(+ 1 2 3 4)
(test 10)))
(v! 1 2 3 4)))
@cbaggers
cbaggers / gist:5c974e02a61f6b5fc920
Last active August 29, 2015 14:24
Implicit Uniform Capture
(defparameter *loop* 0.0)
(defun-g frag ()
(let ((loop *loop*))
(v! (cos loop) (sin loop) 0.4 1.0)))
;; Becomes
using Uno;
using Uno.Platform;
using Uno.Collections;
using Android;
using Android.Base;
using Android.Runtime;
using Android.android.os;
using Android.android.app;
using Android.android.content;
using Android.android.location;
@cbaggers
cbaggers / gist:9eda5eeb6e6cd9c32cb1
Created October 28, 2015 10:06
Fuse example of opening a URI
<App Theme="Basic" ClearColor="1, 1, 1, 1">
<JavaScript>
var InterApp = require('FuseJS/InterApp');
module.exports.openGoogle = function() {
InterApp.launchUri("http://www.google.com");
};
</JavaScript>
<DockPanel>
<TopFrameBackground DockPanel.Dock="Top" />