Skip to content

Instantly share code, notes, and snippets.

@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" />
@cbaggers
cbaggers / flow-id.lisp
Created November 17, 2015 00:16
flow ids with assignment
;; So this code has an assignment (the `setq`) in a deep scope
(defshader test ()
(let ((x 1))
(v! x 0)
(progn
(let ((z 3))
(setq x z)))
(v! x 0 0 0)))
@cbaggers
cbaggers / foreignCode.md
Last active January 6, 2016 14:31
Community preview post on Fuse's Foreign Code Feature v1

Hey folks, Chris here,

I just wanted to writing a quick informal post on fuse's upcoming 'foreign code' feature. What it is, why we made it and where it may be going.

This is very much a first step in our new approach to cross language interop, so whilst this seems somewhat Uno focused today, JS will be joining the party. How this will look is still open for discussion so please hurl opinions at us!

..But I'm getting ahead of myself so let's go back to the problem itself.

###Background Let's recap why we need this stuff at all. We all need to make awesome apps and reinventing the wheel whilst trying to do that sucks. Even though we see ways in which app development could be way better, we also need to be able to leverage the crazy amount of functionality that is already provided. We also hate when a platform stops us from doing something we know how to do (the classic sandbox issue).

baggers@sett:~/Code/lisp/c2ffi/build$ make
Scanning dependencies of target c2ffi
[ 7%] Building CXX object CMakeFiles/c2ffi.dir/src/c2ffi.cpp.o
[ 15%] Building CXX object CMakeFiles/c2ffi.dir/src/options.cpp.o
[ 23%] Building CXX object CMakeFiles/c2ffi.dir/src/OutputDriver.cpp.o
[ 30%] Building CXX object CMakeFiles/c2ffi.dir/src/Type.cpp.o
[ 38%] Building CXX object CMakeFiles/c2ffi.dir/src/Template.cpp.o
[ 46%] Building CXX object CMakeFiles/c2ffi.dir/src/Expr.cpp.o
[ 53%] Building CXX object CMakeFiles/c2ffi.dir/src/AST.cpp.o
[ 61%] Building CXX object CMakeFiles/c2ffi.dir/src/init.cpp.o
@cbaggers
cbaggers / code.lisp
Last active January 27, 2016 09:46
Spaces doing crappy lighting
;;----------------------------------------------------------------------
;; Shader pipeline
(defun-g first-vert ((vert vertex) &uniform (model-space space-g))
(in *clip-space*
(values (in model-space (p! (pos vert) 1.0))
(normal vert)
(uv vert))))
(defun-g first-frag ((norm :vec3) (uv :vec2) &uniform (tex :sampler-2d) (camera-space space-g) (model-space space-g))
@cbaggers
cbaggers / update.lisp
Created January 27, 2016 18:10
update-swank
(defun update-swank ()
"Called from within the main loop, this keep the lisp repl
working while cepl runs"
(continuable
(let ((connection (or swank::*emacs-connection*
(swank::default-connection))))
(when connection
(swank::handle-requests connection t)))))
@cbaggers
cbaggers / v8simple.uxl
Created February 2, 2016 08:52
v8simple.uxl
<Extensions Backend="CPlusPlus" Condition="Android || (CMake && HOST_OSX) || MSVC12">
<Define V8_CPP />
<Template Name="V8Simple">
<Require Condition="Android" LinkDirectory="@('lib/Android':Path)" />
<Require Condition="Android" JNI.SharedLibrary="@('lib/Android/libV8Simple.so':Path)" />
<Require Condition="CMake && HOST_OSX" LinkDirectory="@('lib/OSX':Path)" />
<Require Condition="MSVC12" LinkDirectory="@('lib/Windows/$(PlatformShortName)':Path)" />
<CopyFile Condition="MSVC12" Name="@('lib/Windows/x86/V8Simple.dll':Path)" TargetName="bin/Win32/Debug/V8Simple.dll" />
<CopyFile Condition="MSVC12" Name="@('lib/Windows/x86/V8Simple.dll':Path)" TargetName="bin/Win32/Release/V8Simple.dll" />
<CopyFile Condition="MSVC12" Name="@('lib/Windows/x64/V8Simple.dll':Path)" TargetName="bin/x64/Debug/V8Simple.dll" />
@cbaggers
cbaggers / ecl-type-issue.lisp
Created February 27, 2016 22:41
Confusion around declare in ecl
;; Compiling this..
(defun jam ()
(let ((x #'identity))
(locally (declare (type function x))
(funcall x 10))))
;; .. gives this ..
@cbaggers
cbaggers / inline-glsl.lisp
Created March 19, 2016 16:26
Shows cepl pipeline where one stage is written in glsl instead of lisp. All the usual recompile magic still works
(in-package :cepl.examples)
(defparameter *array* nil)
(defparameter *stream* nil)
(defparameter *running* nil)
(defstruct-g pos-col ()
(position :vec3 :accessor pos)
(color :vec4 :accessor col))
@cbaggers
cbaggers / slime-style.lisp
Created April 16, 2016 15:34
slime start with style
(defun slime-style-init-command (port-filename _coding-system extra-args)
"Return a string to initialize Lisp."
(let ((loader (if (file-name-absolute-p slime-backend)
slime-backend
(concat slime-path slime-backend))))
;; Return a single form to avoid problems with buffered input.
(format "%S\n\n"
`(progn
(load ,(slime-to-lisp-filename (expand-file-name loader))
:verbose t)