Skip to content

Instantly share code, notes, and snippets.

## Source Centric Editing (No Dispersed UI-Only State)
We found that encoding large amounts of app structure and state in the IDE
itself was both highly convenient and also a strong anti-pattern for
understanding, maintanance, and evolution of the app code. It is trivial for
the IDE interface to cause deviations from standard coding practices (for
example, initializer data held only in an IDE instead of the source code),
for the IDE to produce garbage in its representation when the underlying code
changes, and for the IDE to be poor at telling you when this has happened.
@psilord
psilord / foo.c
Last active September 13, 2023 22:21
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct person person;
struct person
{
/* The data fields */
char *first_name;
VIRALITY-EXAMPLES> (disassemble #'foo)
; disassembly for FOO
; Size: 54 bytes. Origin: #x53DDD5EC ; FOO
; 5EC: 498B4510 MOV RAX, [R13+16] ; thread.binding-stack-pointer
; 5F0: 488945F8 MOV [RBP-8], RAX
; 5F4: 488BC6 MOV RAX, RSI
; 5F7: 4801F8 ADD RAX, RDI
; 5FA: 7220 JB L2
; 5FC: 488BD0 MOV RDX, RAX
; 5FF: 48C1C202 ROL RDX, 2
Unstaged changes (4)
modified src/core-early/clock.lisp
@@ -8,12 +8,12 @@
(defun (setf pause-time) (value clock)
(setf (clock-pause-time clock) value))
-(defun make-clock (core)
+(defun make-clock ()
(let ((clock (%make-clock)))
(setf (clock-start-time clock) (sb-ext:get-time-of-day)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(void)
{
int16_t x = 0xc783;
int16_t bitsA = 0, bitsB = 0;
int16_t k = 3;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(void)
{
int16_t x = 0xc783;
int16_t bitsA = 0, bitsB = 0;
int16_t k = 3;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(void)
{
short x = 0xc783;
short bitsA = 0, bitsB = 0;
short k = 3;
;; skel example
;; Ordering semantics.
;; Engine config must come before anything else.
;; v:define-texture have no ordering dependencies between themselves.
;; v:define-texture must come before define-material
;; v:define-materials have no ordering dependencies between themselves.
;; v:define-prefab / v:define-model DOES have an ordering between themselves!
(asdf:defsystem #:skel
(defun %generalized-iterate (gen-idx gen-size)
;; side effect into the vector gen-idx an increment of that index vector.
;; Then return
;; gen-idx if it is valid and we should cont.
;; or
;; NIL if we can't continue iterating over the generalized
;; index because we covered all of the indicies.
(let ((idx-size (length gen-idx)))
(loop
;; a propagation carry loop
(defmethod fire ((ship ship) spawn-class context (muzzle muzzle)
(turret n-shot-turret))
(let ((shot-name (shot-instance-name muzzle)))
(flet ((spawn-the-shot (loc/ent)
(let* ((spread-angle (spread-angle n-shot-turret))
(num-sectors (num-sectors n-shot-turret))
;; Clean up the inputs to be always valid.
(spread-angle (mod (abs spread-angle) (* pi 2d0)))