Posts Tagged css

Fun with jsonselect

One of the strengths of CSS and jQuery is that it provides a common and powerful mechanism known as a selector language for referencing bits of data, especially data whose structure is not exactly known at runtime which makes such an addressing scheme a perfect fit for the often lumpy world of HTML.

Increasingly JSON is being used as a transport medium for data and with the rise of NoSQL solutions, having a selector language for JSON makes a lot of sense when dealing with JSON documents whose structure isn’t deterministic.

JSONSelect provides a good implementation of just such a JSON selector language but after working with it on a project I found myself needing to do more than it allowed me to do. Namely, I wanted 1. to be able to perform a selection and receive matching paths instead of the data contained in those paths and I wanted 2. to be able to modify data specified at a path location in-place.

jsonselect.match(sel, obj, asPath); // Added the asPath flag to return a path instead of the values
jsonselect.forEach(sel, obj, fun, asPath); // Added the same flag to forEach, I use this to
jsonselect.get(path,obj); // For getting the value using a path
jsonselect.set(path, value, obj); // For setting the value of a path
jsonselect.del(path,root); // For deleting a path

Here is my modified version of jsonselect in case anyone needs help solving the same problems I mentioned above.

Tags: , , , ,

A Cascading Style Sheets (CSS) Beginner’s Tutorial

Learning CSS can be a bit daunting if you’ve never encountered it before. Likewise, if you’ve only had limited exposure to CSS, the various ways browsers implement various aspects of the CSS standard (or make up their own) can leave you with the impression that it is all a giant hairy mess. So to help out, I’ve compiled a list of resources to make the learning curve not quite as steep for beginners and to hopefully help tame the CSS wilderness for novices.

First, here is a pretty good and in-depth video on HTML and CSS basics:

Next we have several handy beginner’s tutorial sites:

Finally, here are a few CSS frameworks designed to help make CSS a lot easier by providing a standard system that takes care of much of the common ugly quirks found in CSS:

As a bonus, here are a few inspirational sites to help give you an idea of what CSS can do if applied properly:

Tags: , , ,