Skip to content

Instantly share code, notes, and snippets.

View leostratus's full-sized avatar

Leo Stratus leostratus

View GitHub Profile
leostratus /
Created September 21, 2012 01:44
Webkit Pseudo-Element Selectors (Shadow DOM Elements)

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:


localForage Offline Storage, Improved

Web apps have had offline capabilities like saving large data sets and binary files for some time now. You can even do things like that you could write an app that cache MP3 files. Browser technology can store data offline and plenty of it. The problem, though, is that the technology choices for how you do this are fragmented.

localStorage gets you really basic data storage, but it's slow and can't handle binary blobs. IndexedDB and WebSQL are asynchronous, fast, and support large data sets, but their APIs aren't very straightforward. Even still, neither IndexedDB nor WebSQL have support from all of the major browser vendors and that doesn't seem like something that will change in the near future.

If you need to write a web app with offline support and don't know where to start, then this is the article for you. If you've ever tried to start working with offline support but it made your head spin, this article is for you to

leostratus / AI-CogSci-Reading-List-RobotsConf-2013
Created December 7, 2013 17:50
This is an AI/Cognitive Science reading list from discussions at RobotsConf 2013. Please add to this list in the comments. Bonus point if all y'all keep 'em in chronological order. I'll update the master list later today! (Saturday December 7th 2013) Format: { Title } { Year_of_Publication } { Amazon_Link } { Short_Description}
How to Create a Mind
Great pop-cogsci book on Kurzweil's pattern recognition theory of mind. AI concepts such as hierarchal-hidden-markov-models and neural nets are discussed.
Consciousness: An Introduction
This file has been truncated, but you can view the full file.
Before the End
Chapter 1
Casterly Rock was just as grand as she had been told it was. The castle sat proudly on top of a vast amount of rocks, looking out the glimmering sea. The views were spectacular and the castle decorated even more so. She wondered if she had ever seen such a sight before. She kept silent as she stood on the balcony, awaiting her parents to return to her. She kept her hands on the stone and her back straight. She did her best not to slump, recalling the manners which her mother and septa had taught her to have.
She continued to stare out to the sea, watching as ships sailed, her green eyes alight with wonder. At the age of ten and seven she often found pleasure in simple things she had not seen before. She had never been to the coast, but the sea air was so refreshing against her pale skin. She could not help the smile on her face.
It was only when she heard the door to the solar open did she turn around and look behind her. A simple net curtain was the only thing which separated th
NN: torch-rnn w/lstm flag set
Dataset: Tiny Shakespeare (~1MB)
Layers: 3
Nodes: 256
Any so I do go! my seques! where's mes!
I send firm incensed: Has a talk.
leostratus / gist:6732601
Created September 27, 2013 18:05
An argument against using open source (free) tools and services from someone in the natural sciences. Let's not make fun of them, let's figure out how to educate scientists on the merit of open-source software and how it can help with everything from code review to transparency of process.
I understand the younger generation thinks everything should be free.
Well, I grew up in a country where everything was actually free. (The few things we actually could have). A worker's paradise!
As you may have heard, that country is no more, and "everything is free" was a major reason for it's demise. (To this day, they are still dividing up all the formerly free stuff)
If any lesson I learned, it is that people who do stuff should be compensated for their work
and services (commonly acceptable unit of compensaton is called "money").
So all this talk about using services because they are free is crazy talk and it leads in the same direction the whole Soviet Union happily marched off.
leostratus / gist:5807770
Last active December 18, 2015 15:58
Copy-paste-able code for my Kensington slide clicker so that it works with my HTML/CSS slide deck. Note that if you have a Kensington remote with multiple modes that you'll want to be in 'emulate mouse' mode.
// This shit because my Kensington presentation clicker wasn't programmable
// Seriously I should have bought a Logitech
document.body.onclick = function(e) {
bespoke.prev(); // Change this to whatever function selects the previous slide for view for your deck
return false;
document.oncontextmenu = function (e) {; // Change this to whatever function selects the next slide for view for your deck
leostratus /
Created April 23, 2013 21:32
Moves your OS X default postgres binaries into an archive folder and symlinks the homebrew versions in place of them. Originally from
BREW_POSTGRES_DIR=`brew info postgres | awk '{print $1"/bin"}' | grep "/postgresql/"`
LION_POSTGRES_DIR=`which postgres | xargs dirname`
LION_PSQL_DIR=`which psql | xargs dirname`
sudo mkdir -p $LION_POSTGRES_DIR/archive
sudo mkdir -p $LION_PSQL_DIR/archive
for i in `ls $BREW_POSTGRES_DIR`
if [ -f $LION_POSTGRES_DIR/$i ]
leostratus /
Created September 21, 2012 18:37
HTML Entities/HTML Escape Characters

Because somehow I always end up trolling the interwebs looking for a reference for these.

Symbol Code Entity Name
leostratus / curl-tidy-xml
Created September 18, 2012 17:24
curl - command to retrieve tidy XML from an API endpoint in your terminal
curl -v -X GET "" | tidy -xml -utf8 -i