highlights from the portfolio of Asa Baylus

A nice visual log for Git command line

I like having a quick visual log for Gits command line. Here’s a little git alias which’ll display a brief and colorful summary for your projects.
Enter the following code in terminal or git bash.

https://gist.github.com/1468122

You can now generate a visual tree style log, open your shell

# show me everything
$ git vlog
# show the last 6 commits
$ git vlog -n6

 

Amazon ec2 says “sudo: sorry, you must have a tty to run sudo”

I’ve got a script on an Amazon EC2 64bit Linux which I’d like to remotely trigger using ssh. But when I call this script the following error message appears:

"sudo: sorry, you must have a tty to run sudo"

Here’s a quick and I believe secure way to invoke a remote command via ssh which uses sudo without completely disabling requiretty
Note the following when running visudo

#
# Disable "ssh hostname sudo ", because it will show the password in clear.
#         You have to run "ssh -t hostname sudo ".
#
Defaults    requiretty

Adding -t allows the command to execute without requiring tty, according to the ssh doc -t…

[Forces] pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can bevery useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

Here’s a sample SSH command…

# run an arbitrary command
$ ssh -i my.pem -t ec2-user@127.0.0.1 'sudo reboot'

or
# run my script which has some sudo function"
$ ssh -i my.pem -t ec2-user@127.0.0.1 '/path/to/script/doit'

 

Convert Milliseconds into digital time [ 00:00 ]

JavaScript works with time in milliseconds, which is less than convenient when you want to present time back to your users. Here’s a little function that can help you convert milliseconds into a more human readable digital clock style string.

Continue Reading »

iframeFitContent a jQuery Plugin

Aside from using the jQuery contents(); method to access iframe content, this plugin determines the actual height of the content, rather than using scrollHeight then adding X amount of extra height to the iframe itself.

Documentation:

To install the iframeFitContent plugin, download jquery-iframefitcontent.min.js and link to the script after installing jQuery 1.4.x. Then in a new script block call the .iframeFitContent(); method on a jQuerified object which contains a reference to iframes you’d like the plugin to resize.

To run the plugin on all iframes use the following code:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="http://www.yourserver.com/js/jquery.iframefitcontent.js" type="text/javascript"></script>
<script type="text/javascript">
	$('iframe').iframeFitContent();
</script>

To add padding to the bottom of your iframe add the padding parameter as follows. Note the padding value must be set as an number.
Or apply the re-size to either height or width:

    $('iframe').iframeFitContent({ resize : 'height' });

Current version: 1.0
Compressed filesize: 1.112 kb
License: MIT

Files:

Download
Demos
GitHub Repository

Dependencies

Support

  • Please post bug reports and other contributions ( enhancements, features ) to the gitHub issues tracker.

Load YUI-CSS from the Google Ajax Library

I’m using Google CDN to load my Ajax libraries specifically jQuery and jQuery UI. Its been working great but I’m often annoyed that I have to load Yahoo!’s YUI-CSS files from the yahoo CDN. However I recently found that I did not need to do this. Google also maintains the YUI-CSS files which can be accessed using the following URL:

http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css

which is equivalent to:

http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css

Since DNS lookups are cached, keeping the number of domains to a minimum gives you a small performance boost.

“The Domain Name System (DNS) maps hostnames to IP addresses, just as phonebooks map people’s names to their phone numbers. When you type www.yahoo.com into your browser, a DNS resolver contacted by the browser returns that server’s IP address. DNS has a cost. It typically takes 20-120 milliseconds for DNS to lookup the IP address for a given hostname. The browser can’t download anything from this hostname until the DNS lookup is completed.”

Read more at Yahoo!

Custom Rounded CSS Corners with Alpha

Creating rounded corners boxes proves a fairly difficult challenge. While there are numerous elegant solutions to this problem for the purposes of the design proposed for ACS.org Release 2, none of these solutions was ideal.

Both spiffy corners and nifty corners are great solutions.  However, I needed to consider what might happen when user added alot of boxes to a page. How would these JavaScript heavy solutions perform? Also there is the issue of users who have disabled JavaScript in their browsers. I wanted a solution which could swing both ways. A solution which could be created using CSS only or be applied with JavaScript. Finally, I want rounded corners for a designer. I wanted a solution which could be custom themed one in which the corners could all be different, so of course this means using images for the borders and the corners.
Custom Corners Demonstration

A few notes…

First I’ll be updating this post soon with some graphics and instruction, but for now just go here
Custom Corners Demonstration.

Also, I ran across this post from 465 Berea St Transparent custom corners and borders, version 2

Anyhow, that technique seems very close to my own. I’ll update this post with the differences once I’ve had a chance to see how my technique differs from Roger’s.

The best design portfolio on the interweb!

I was googling for some inspiration for this website when I discovered Noah Stokes. He may be the best designer in the whole interweb thingy. Check him out at http://noahstokes.com while I pack my things and start looking for a new profession.

User testing from a designers perspective

A couple of weeks back we took our latest website site design to the annual conference which my employers host. This is a pretty well attended event which takes place over three days. I was told that 14,000 people came to the event this year. A healthy number by my standards and a great opportunity to conduct user testing.

Continue Reading »

Why I’m developing with Yahoo Astra

Yahoo Astra is Yahoo’s answer to the components that are missing from flash, such as: tree menu, alert windows, carousel, charts, auto suggest, menu, menu bar, tab bar and layout managers.

Many of these elements can be found in Flex Flash Builder, but that won’t do you much good if you are developing in the flash IDE.

I’m using these components in a few projects I’m working on at ACS. By using Astra I’m getting the not insignificant benefit of standing on the shoulders of some very smart and accomplished programmers. Yahoo Astra components have numerous features which accommodate most common situtations and the components can of course be extended to fit your sites specific needs.

You can find Yahoo Astra at: http://developer.yahoo.com/flash/astra-flash/

There seems to be a lot going on with flash this past week. Adobe has posted Flash Builder 4 on labs along with Flash Catalyst aka Thermo. This is seems like a good time to check out labs.adobe.com

Selecting Checkboxes with jQuery

jQueryThis video demonstrates using jQuery to select checkboxes and mark them checked. Also covered is selecting a group of related checkboxes using jQuery’s filter.

Continue Reading »

Page 1 of 212