Skip to content

Instantly share code, notes, and snippets.

View leostratus's full-sized avatar
⌨️
computering

Leo Stratus leostratus

⌨️
computering
View GitHub Profile
@leostratus
leostratus / high-ppi-media-queries.css
Created August 27, 2012 20:48
Media Query w/all vendor prefixes required for high PPI devices (eg. Retina display iPhone 4)
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (-o-device-pixel-ratio: 3/2),
only screen and (min-device-pixel-ratio: 1.5) {
/* High-res version of image assets go here */
}
@leostratus
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 "https://someAPIendpoint.com/?getStuff" | tidy -xml -utf8 -i
@leostratus
leostratus / webkit-pseudo-elements.md
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:

-webkit-appearance:none;

@leostratus
leostratus / html-entities.md
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
leostratus / fix-lion-postgres.sh
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 http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/
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`
do
if [ -f $LION_POSTGRES_DIR/$i ]
@leostratus
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) {
bespoke.next(); // Change this to whatever function selects the next slide for view for your deck
@leostratus
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. http://www.interdisciplinaryprogramming.com
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
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
2013
http://www.amazon.com/How-Create-Mind-Thought-Revealed/dp/0143124048/
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
2003
http://www.amazon.com/Consciousness-Introduction-Susan-Blackmore/dp/019515343X/

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
leostratus / gist:9905175
Last active August 29, 2015 13:57 — forked from cube-drone/gist:9903789
Angelina's edit of Curtis' script on basic usability for apps
5 Crucial Usability Tips for App Designers and Developers
----------------------------------
Hey, everyone. I'm Curtis Lassa, and I'm here to share some very simple
usability guidelines with you for application development.
By the end of this video, you should have a better understanding of how to design a UI that is intuitive and easy for your users to make sense of.
Let's begin by examining one of the fundamental pieces of applications on the web: hyperlinks. On a dekstop, it's much easier to be precise about where you want to click because your mouse cursor is small. You know what's not small? Our fingers. Relative to the pointer, of course. So, this means that when you're considering your application for touch-screen devices, you need to adapt accordingly.