It can be annoying that when you drag out images of a browser window, they are named png.png (or something equally useless). I was playing around with fixing this – it is a little inconvenience in my CSS Sprite Generator that would be nice to have working (naming the file based on their input). Here is what I came up with (no library dependancies):
You just need to specify the alt attribute on the image or canvas to specify your name (along with the draggable attribute on canvas elements) and the script should handle the rest.
Browser Support
I am not 100% sure on browser support. This used to be Chrome only according to this HTML5rocks article, but maybe other browsers have picked it up by now. It is a neat little addition when available though.
I’ve been working on updating my A* Graph Search Algorithm (A* on Github) and toying with the idea of adding variable costs to the grid, also known as weighted paths.
I opened an issue to add weighting to graph nodes a while ago, but am a little stuck on the implementation details. My initial thought was to change the semantics of the graph. Right now, here is a sample graph:
var GraphNodeType ={OPEN:0,
WALL:1};// 0 represents an open node, 1 represents a wall var graph =new Graph([[0,0,0,0],[1,0,0,1],[1,1,0,0]]);
My initial plan for adding weighting was something like this:
var GraphNodeType ={
WALL:0,};// Anything > 0 represents the cost to travel to that node, 0 represents a wallvar graph =new Graph([[2,1,3,4],[0,1,1,0],[0,0,3,10]]);
One major issue with that is that it breaks backwards compatibility with the plugin. A user, spellfork, on the Github issue came up with a neat solution, basically passing in two separate arrays to the graph function, where one represents the “obstacle map” (walls), and the second represents the “terrain map” (costs).
// First array: 0 represents an open node, 1 represents a wall // Second array: movement costs are represented by numeric value var graph =new Graph([[0,0,0,0],[1,0,0,1],[1,1,0,0]],[[2,1,3,4],[0,1,1,0],[0,0,3,10]]);
This is nice because the terrain map is optional, but not as nice if you need to do a lot of work to generate the two separate maps.
Maybe there is a better solution that I am not thinking of? Any ideas about the best way to implement this? Drop a comment here or over in the Github issue to help get this implemented!
I think it’s a pretty cool plugin that is a lot nicer than using the standard hacks for keeping textarea heights up to date. And it works really well with proportional widths, custom fonts, and min/max heights!
Here is a screenshot (which also links to the demo):
I put together a screencast explaining the colorpicker functionality recently added into WebKit Web Inspector (aka Chrome DevTools for brevity). For some backstory on how this got implemented, check out my initial colorpicker concept video or the description of the implementation.
Here is a quick screencast showing off the colorpicking functionality (currently running in Chrome Canary):
Oh, and the jQuery plugin I am working with is called unmodal.
I have been working a browser based gradient generator. I’ve never had the best experience using gradient generators, so I decided to see if I could do better.
It is a prototype right now (a weekend project), but I am hoping to do more with it as time permits.
Features
It outputs to CSS, Canvas, and SVG
Allows for separate color and alpha stops
Keyboard support (left, shift+left, right, shift+right, ctrl+c, ctrl+v)
Given a parent rectangle and a collection of children rectangles on a 2D plane, how do you find a collection of non-overlapping rectangles that cover the inverse of the original set?
For instance, given the container rectangle along with the set [A, B] -> we want an output similar to [1, 2, 3, 4, 5].
At Foliotek, we have a lot of components we have built (and are in the process of building) for our various projects.
We are open sourcing some of these, and the first one is the AjaxQ jQuery Plugin. The purpose of this plugin is for managing sequential ajax requests.
It is designed to follow the $.ajax, $.get, and $.post interfaces and return values, only taking one extra parameter (the queue name). Here is a brief sample of the functionality:
From there, I opened a development case, entitled Web Inspector: Add colorpicker functionality to color swatches in Styles Sidebar. 50+ comments and 10 patches later, the case landed in WebKit. This is really exciting, since it will improve the development experience for Chrome and Safari users. Thanks to all the WebKit developers who helped me along the way with getting the code and UI ready for committing (I needed all the help I could get).
I am planning on sharing more of the technical details and hurdles I had as a first time contributor to the WebKit project in a coming post.