Skip to content

Instantly share code, notes, and snippets.

View vasilisvg's full-sized avatar

Vasilis van Gemert vasilisvg

View GitHub Profile
@vasilisvg
vasilisvg / no-touch-hover.md
Created October 10, 2011 16:57
Set :hover for non-touch devices only

No :hover for touch devices

Some touch devices trigger the mouseover event on the first touch when something changes visibly. This happens even with simple changes like a new color or removal of an underline. The click-event only fires the second time you touch.

This is easy to solve, if modernizr is included, by adding the class .no-touch to each :hover rule.

.no-touch a:hover { color: #06e; }

How to backup a bootable Pi image to your Mac

Mount your disk on your Mac.

#returns a list of disks, find yours, could be something like /dev/disk2
diskutil list 

# Unmount disk, weird but true.
diskutil unmountDisk /dev/disk2

Saving power on your raspberry pi

Most of my Raspberry Pis do one single thing well. Which means that there is probably quite some stuff that can be disabled. For instance, if you use your Pi without a monitor, you can disable the firewire. And if you don’t need an ethernet and don’t need a USB connection, you should disable those. It will save quite some energy.

Shut off your Pi

I guess the number one tip is to shut down your Pi when you don’t need it. For some applications a simple on/off button would work. Here’s a nice, very simple explanation of how to do that.

Disable the USB and Ethernet block

@vasilisvg
vasilisvg / dabblet.css
Created April 24, 2013 09:00
A simple menu with a :hover action
/**
* A simple menu with a :hover action
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font: 100%/2.5 helvetica, arial;
}
@vasilisvg
vasilisvg / Headless-Pi.md
Last active November 3, 2019 21:59
How to set up a headless pi

Download the latest version of Raspbian Lite, which is the version without a desktop environment.

First install Raspbian onto a mini sd card using a tool like Etcher. When the burning is done, mount the drive onto your computer. If we want to access the Raspberry PI using SSH (which we want) we need to add two files to the root of the mounted drive before we can use it in the Pi:

  • A file called ssh with no content.
  • A file called wpa_supplicant.conf which should have your wifi credentials and look something like this (change the country to your country code):
country=NL
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
@vasilisvg
vasilisvg / better-ads-on-ecosia.js
Last active September 24, 2019 21:32
This Tampermonkey script enhances the ads on ecosia to look like coloured rectangles on coloured backgrounds. Ads do get shown, trees do get planted.
// ==UserScript==
// @name Improved art direction on ads in Ecosia
// @namespace http://tampermonkey.net/
// @version 0.8
// @description This script enhances the ads on ecosia to look like coloured rectangles on coloured backgrounds. Ads do get shown, trees do get planted.
// @author Vasilis
// @match https://www.ecosia.org/*
// @grant none
// ==/UserScript==
@vasilisvg
vasilisvg / responsive-context-images.html
Created September 7, 2011 10:50
Responsive context aware images without cookies or server logic
<!doctype html>
<!--
WARNING!
You probably shouldn't use this technique since images never show up
if the script isn't loaded for one reason or another. Some reasons:
- The content is viewed using a RSS reader
- The content is viewed with a read-it-later service
- The user has a flaky connection (hotel wifi, Dutch train, etc)
-->

Principles of inclusive desin

As found in the book Inclusive Design: Design for the Whole Population These principles seem to be focused on physical products mostly. These principles are described in chapter 19: Universal products in the US. So, to be more accurate, these should probably be called the seven principles of universal design. Even though I’m not sure every life form in the universe will find them equally useful.

Principle one: equitable use

The design is useful and marketable to people with diverse abilities. Guidelines:

@vasilisvg
vasilisvg / dabblet.css
Created November 13, 2016 14:03
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
a,
a:visited,
a:hover,
a:focus {
text-decoration: none;
text-shadow: .05em 0 0 #fff,-.05em 0 0 #fff,0 .05em 0 #fff,0 -.05em 0 #fff;
background-image: linear-gradient(to right, currentColor 0%, currentColor 100%);
@vasilisvg
vasilisvg / google-plus-userscript.js
Created July 14, 2011 08:53
Google+ unread messages userscript
// This script shows a badge with the number of new messages in the dock of your Fluid instance of Google+
// The count is reset when you click somewhere in the body
// This version of the script is written by Mathias Bynens
(function(window, document) {
var nodeList = document.getElementsByClassName('a-b-f-i a-f-i'), // live NodeList
fluid = window.fluid,
length;