Skip to content

Instantly share code, notes, and snippets.

View city41's full-sized avatar
🙃

Matt Greer city41

🙃
View GitHub Profile
@city41
city41 / vram.lua
Created January 21, 2024 03:53
MAME neo geo vram lua script
-- how to use:
-- mame -autoboot_script path/to/vram.lua <game>
cpu = manager.machine.devices[":maincpu"]
mem = cpu.spaces["program"]
screen = manager.machine.screens[":screen"]
-- what vram looked like last frame
prev_vram = {}
-- what vram looks like this frame
@city41
city41 / gist:e0080a93c0e8f8e1eac8cf6d8ff33fc5
Created October 20, 2019 20:55
chromium version for window onCreated question to Chromium newsgroup
Chromium 76.0.3809.121 (Official Build) (64-bit)
Revision d28530da606049009612d26e41b73a92e2bf3299-refs/heads/master@{#692470}
Platform 76.4.69 (Developer Build - neverware) stable-channel chromeover64
Firmware Version
JavaScript V8 7.6.303.31
Flash (Disabled)
User Agent Mozilla/5.0 (X11; CrOS x86_64 12239.2.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.121 Safari/537.36
Command Line /opt/google/chrome/chrome --use-gl=egl --gpu-sandbox-failures-fatal=no --enable-logging --log-level=1 --use-cras --enable-wayland-server --user-data-dir=/home/chronos --enable-features=MachineLearningService,MyFilesVolume,Crostini,ExperimentalCrostiniUI --system-developer-mode --login-profile=user --default-wallpaper-is-oem --aura-legacy-power-button --default-wallpaper-large=/usr/share/chromeos-assets/wallpaper/oem_large.jpg --default-wallpaper-small=/usr/share/chromeos-assets/wallpaper/oem_small.jpg --default-wallpaper-is-oem --enterprise-enrollment-initial-modulus=15 --enterprise-enrollment-modulus-limit=19 --log
@city41
city41 / tileRoom.cpp
Last active September 23, 2018 18:58
Ardynia's loadRoom (RLE decompression) method
/**
* Load a compressed room from progmem into RAM
*
* maps are compressed in two ways:
*
* * two tiles per byte, as there are less than 16 tiles
* * run length encoding is employed to remove long runs of the same tile
*
* The RLE is done per room, and there is a header section containing the starting
* index of each room. This is because with RLE compression, each room will have a different
@city41
city41 / drawBitmap.cpp
Last active September 10, 2018 23:59
Arduboy2's Sprite and ArdBitmap primary drawBitmap methods combined into one
#include "drawBitmap.h"
#include <Arduboy2.h>
/**
* draw a bitmap with an optional mask, optional mirroring and optional inverting
*
* This code is a combination of Arduboy2's Sprite::drawExternalMask() and Ardbitmap's drawBitmap()
*
* This method can accomplish the same effect as most of Sprite's methods:
* drawOverwrite: pass in a mask of NULL
@city41
city41 / ardbitmapBug.ino
Created August 26, 2018 15:05
ardbitmap vertical mirror problem
#include <SPI.h>
#include <EEPROM.h>
#include <Arduboy2.h>
#include <math.h>
Arduboy2 arduboy;
#define ARDBITMAP_SBUF arduboy.getBuffer()
#include <ArdBitmap.h>
ArdBitmap<WIDTH, HEIGHT> ardbitmap;
import React from 'react';
import { renderToString } from 'react-dom/server';
import { MockedProvider } from 'react-apollo/test-utils';
export const replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
const ConnectedBody = () => (
<MockedProvider>
{bodyComponent}
</MockedProvider>
);
@city41
city41 / gist:e3a822fc4c2d3104443b
Last active August 29, 2015 14:14
cljs :main

project.clj snippet:

:cljsbuild {:builds {:app {:source-paths ["src/cljs"]
                             :compiler {:output-to     "resources/public/js/app.js"
                                        :output-dir    "resources/public/js/out"
                                        :externs       ["react/externs/react.js"]
                                        :main my-app/core
                                        :optimizations :none
 :pretty-print true}}}}
@city41
city41 / gist:aab464ae6c112acecfe1
Last active January 19, 2021 12:51
ClojureScript secretary client side navigation without hashes

This is the example that comes with the reagent template converted to use HTML5 based history. This means there are no # in the urls.

I just got this working, so there might be better approaches

The changes are

  • use goog.history.Html5history instead of goog.History
  • listen to clicks on the page, extract the path from them, and push them onto the history
  • listen to history changes, and have secretary do its thing in response
@city41
city41 / gist:680c728cdf69ff780c88
Last active August 29, 2015 14:00
Show indentation in Atom
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/