It’s pretty easy to get the headers of incoming requests using PHP. If you’re using Apache, you can simple do something like:
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />\n";
}
If you’re not using Apache, your best bet is to try and extract them from the $_SERVER variable. Something like this would do the trick:
print_r(getHeaders());
function getHeaders()
{
$headers = array();
foreach ($_SERVER as $k => $v)
{
if (substr($k, 0, 5) == "HTTP_")
{
$k = str_replace('_', ' ', substr($k, 5));
$k = str_replace(' ', '-', ucwords(strtolower($k)));
$headers[$k] = $v;
}
}
return $headers;
}
I spend a lot of time in terminal, and on my mac, so I am constantly looking for ways to make it a little better. And color is one of the best ways…
So to enable colors in terminal on a mac, the first thing you need to do is to create a .bash_profile
- Open up your terminal
- Type ‘ cd ~’ to go to your home folder.
- Type ‘touch .bash_profile’ which will create your new bash file.
- Edit the ‘.bash_profile’ file you just created with your favorite text editor.
- Add in these two line to the file:
export CLICOLOR='true' export LSCOLORS="gxfxcxdxbxegedabagacad"
- Go back to your terminal and type ‘. .bash_profile’ (note the space between the periods).
- Try it now with an ‘ls’ command. If it still isn’t in color, try restarting your terminal.
I love Panic’s Coda, and I am anxiously awaiting their new version, since I think it’s just a few features away from being the perfect editor. That being said, while researching if there was a way to sort the Code Navigator alphabetically (there isn’t) I came across the bookmarks feature, which I never knew about. So if you use the Code Navigator (and you should) you can add inline comments in your page, which will then appear in the code navigator–which makes it so much nicer when you organize your code well, and and you’re editing a long file.
The syntax to add a bookmark is as follows:
CSS: /* !some description of where you are in the file */ HTML: <!-- !some description of where you are in the file --> Javascript: /* !some description of where you are in the file */ or // !some description of where you are in the file PHP: /* !some description of where you are in the file */ or // !some description of where you are in the file
Note that in all cases, your text needs to have the '!' infront of it to work.
Enjoy!
Normally I’d write this off as just another JavaScript Libraray, but because it comes from Dustin Diaz I can’t. That would be like writing Tiger Woods off as just another golfer.
Ender.js, an open submodule library. Ender is a small yet powerful JavaScript library composed of application agnostic opensource submodules wrapped in a slick intuitive interface. At only 7k Ender.js can help you build anything from small prototypes to providing a solid base for large-scale rich applications.
From his blog.
Add CSS styles to any website, and share the result with a short link. Invite others to submit improvements for your website.
Tempo is a tiny JSON rendering engine that enables you to craft data templates in pure HTML.
Looks nice.
It seems like QR codes are about to go mainstream, since I’m hearing about it all the time. They’re actually pretty cool, allowing you to provide an image, that when scanned with any number of mobile phones, will take you directly to a website or provide you with some information. Luckily enough, with a little PHP and some help from Google they’re super easy to generate.
Here’s the Code:
function createQR($url,$size ='150',$evLevel='L',$margin='0') {
$url = urlencode($url);
return '<img src="http://chart.apis.google.com/chart?chs=' . $size . 'x' . $size . '&cht=qr&chld=' . $evLevel . '|' . $margin . '&chl=' . $url . '" alt="QR code" width="' . $size . '" height="' . $size . '"/>';
}
echo createQR('http://www.wickedbrilliant.com',150);
That would generate a QR Code that looks like this:
Lemme know if you have any questions, otherwise enjoy!
Seriously, this made me tear up a little bit:
There you have it: the bullying triple-play. A kid who is already fragile, kids at school that are overly confident, and a weird – to some – obsession with something that no one else understands. I’ve been there. I’m sure most of you have been there. There’s little to be done. So Carrie wrote a post about her daughter’s experience and tried to work through it alone. This was on November 15. Then the Internet got involved.
via The Tale Of the Littlest Jedi: Bullied Girl Gets Star Wars Love.
Facebook is currently testing a new registration plugin that enables websites to make it easier for users to register for their site.
Site owners will be able to select which fields they’d like to capture and then as much of that information will be pre-populated with Facebook data. It’s a system which will assist in the “user onboarding” process for sites. While Facebook had previously prevented developers (via the terms of service) from pre-populating forms with Facebook data, this new product makes things much easier.
As you might know, HTML5 introduced many exciting features for Web developers. One of the features is the ability to specify gradients using pure CSS3, without having to create any images and use them as repeating backgrounds for gradient effects.


