Cross-browser buttons with CSS3 and Sass

Using CSS3 isn’t quite as easy as it should be. Lots of advanced functionality requires using vendor prefixes which easily bloats your stylesheet with repetitive properties.

One solution to this is using Sass. Especially Sass mixins and color functions can radically reduce the amount of code you need to write. Combine that with CSS3Pie to add IE support and you have quite elegant solution for making cross-browser supported CSS.

Making buttons

Here’s one way of making nice looking buttons with pure CSS3. Rounded borders and gradient can be added this way with no extra markup or images.

Enable CSS3Pie support

@mixin pie //using CSS3Pie for IE support behavior: url(/PIE.htc) .pie @include pie

On a side note, if you want to serve PIE.htc with app engine add this to your app.yaml:
- url: /PIE.htc static_files: media/css/PIE.htc mime_type: text/x-component upload: media/css/PIE.htc

Sub mixin for gradients

@mixin vertical-gradient($bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4) // cross browser mixin for gradients @extend .pie background: $bgcolor1 background: -moz-linear-gradient(0% 100% 90deg, $bgcolor1 0%, $bgcolor2 50%, $bgcolor3 50%, $bgcolor4 100%) background: -webkit-gradient(linear, 0 0, 0 100%, color-stop(0, $bgcolor4), color-stop(0.5, $bgcolor3), color-stop(0 ...

App Engine helpers for ZSH

Here are some zsh helpers for Google App Engine will save you lot of typing in the long run. I’ve extendend the oh-my-zsh project with my own plugin for Google App Engine, but you can easily just add these to your .zshrc.

Uploading app

To use this alias you need to define GAE_EMAIL and GAE_PASS in your .zshrc. This saves you typing them in the first time.
alias gaeup="echo $GAE_PASS|$GAE_SDK/appcfg.py update . --email=$GAE_EMAIL --passin"

Helpers for bulkloader

Using bulkloader to download/restore multiple entities can be painful with all the manual steps. This helper is for downloading raw entity data from a live site for given Kind. Usage: gaebulkdl Kind app_id. Note: the _ah/remote_api is default for Python SDK 1.3.8 builtins.
function gaebulkdl() { echo $GAE_PASS|$GAE_SDK/bulkloader.py --dump --kind $1 --filename=$1.bin \ --url=http://$2.appspot.com/_ah/remote_api --email=$GAE_EMAIL --passin }

This function is for restoring downloaded data. Usage: gaebulkup Kind localhost.fi:8080 app_id email password
function gaebulkup() { echo $5|$GAE_SDK/bulkloader.py --restore --kind=$1 --filename=$1.bin \ --url=http://$2/_ah/remote_api --app_id=$3 --email=$4 --passin }

Decorator for executing a function in a given namespace

The 1.3.6 update for App Engine introduced support for multitenancy using namespaces. You might want to read the introduction by Nick Johnson to read what it means. Here is a snippet for function decorator allowing you to run function in given namespace. Code is based on this.

Fork me on GitHub