Skip to content

Instantly share code, notes, and snippets.

@city41
city41 / gist:e0080a93c0e8f8e1eac8cf6d8ff33fc5
Created Oct 20, 2019
chromium version for window onCreated question to Chromium newsgroup
View gist:e0080a93c0e8f8e1eac8cf6d8ff33fc5
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 Sep 23, 2018
Ardynia's loadRoom (RLE decompression) method
View tileRoom.cpp
/**
* 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 Sep 10, 2018
Arduboy2's Sprite and ArdBitmap primary drawBitmap methods combined into one
View drawBitmap.cpp
#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 Aug 26, 2018
ardbitmap vertical mirror problem
View ardbitmapBug.ino
#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;
View gatsby-ssr.js
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>
);
View gist:e3a822fc4c2d3104443b

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 Mar 14, 2019
ClojureScript secretary client side navigation without hashes
View gist:aab464ae6c112acecfe1

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
View gist:12099b91e0fbb526b0dc
@city41
city41 / gist:680c728cdf69ff780c88
Last active Aug 29, 2015
Show indentation in Atom
View gist:680c728cdf69ff780c88
/*
* 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
*/
View pre-push.sh
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
You can’t perform that action at this time.