Skip to content

Instantly share code, notes, and snippets.

(setq shoes-off-config
`((:username ,(getenv "rcirc_bouncer_username")
:password ,(getenv "rcirc_bouncer_password")
:server-alist (("irc.freenode.net"
:nick "PuercoPop"
:port 6667
:user-name "PuercoPop"
:password "NinjaKittens"
:full-name "Full Name"
:channels ("#emacs" "#lisp" "#limajs" "#python.pe"))))))
(defpattern sdl-event (type key state)
`(and (sdl:event-type (type (eq ,type)))
(sdl::key-key (key (eq ,key)) ,state)))
(setf (fdefinition 'event-typep) #'sdl:key-down-p)
(sdl:with-init (sdl:sdl-init-video)
(sdl:window 256 240 :bpp 24 :sw t)
(sdl:enable-key-repeat 10 10)
(unwind-protect (let ((event (sdl:new-event)))
@PuercoPop
PuercoPop / First draft.lisp
Last active August 29, 2015 14:01
Fuck lispbuilder's event-loop
(in-package :famiclom)
(require 'sb-sprof)
(defun check-for-input ()
(let ((event (sdl:new-event)))
(loop
;; Pops the event-queue and binds it to event, return 0 if no pending
;; events.
:for event-poll = (sdl-cffi::SDL-Poll-event event)
(in-package :famiclom)
(defun get-byte-input% (addr)
(declare (ignore addr))
(format t "Reading button ~A: ~A~%" (first (pad-strobe *pad*)) (get-state *pad*))
(prog1 (get-state *pad*)
(next-state *pad*)))
(let ((last-input 0))
@PuercoPop
PuercoPop / profile-with-sdl-event-loop.lisp
Last active August 29, 2015 14:01
profile famiclom with sdl event loop. Most of the time spent busy-waiting.
(defun profile! (&optional (mode :time))
(reset *nes*)
(load-rom "/home/puercopop/quicklisp/local-projects/famiclom/roms/smb.nes")
(sb-sprof:with-profiling (:sample-interval 0.001
:alloc-interval 2
:max-samples 1000
:show-progress t
:report :graph
:mode :time
:reset t)
(defun play-rom (file)
(reset *nes*)
(load-rom file)
(sdl:with-init (sdl:sdl-init-video sdl:sdl-init-audio)
(sdl:window 256 240 :bpp 24 :sw t)
(sdl:enable-key-repeat 10 10)
(sdl:with-events (:poll)
(:quit-event () t)
(:key-down-event
(:key key-pressed)
(in-package :famiclom)
;; Launch an sdl-window. After Pressing p, the inputs are polled and
;; then. displayed in the window or written to stdout.
(defstruct pad
(buttons (make-array 8 :element-type 'boolean :initial-element nil))
(strobe '(:a :b :select :start :up :down :left :right))
(index 0 :type fixnum)) ;; Used for strobe method
(in-package :famiclom)
;; Launch an sdl-window. After Pressing R, the inputs are polled and
;; then. displayed in the window or written to stdout.
(defvar *last-key-pressed* nil)
(defclass pad ()
((a :initform nil :accessor button-a
loginButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// First check if email or password are empty, if any of those
// is empty, focus them. Else try to authenticate on the
// endpoint.
final EditText email = (EditText) rootView.findViewById(R.id.login_email);
final EditText password = (EditText) rootView.findViewById(R.id.login_password);
AuthenticatorMock authenticator = new AuthenticatorMock();
try {
(add-hook 'save-hook (lambda () (shell-command "Youur command"))