Font Squirrel – CSS3 Fonts

If you need a website with a non-standard font, Font Squirrel is the solution!

The important feature of this website is the @font-face Generator. It let you upload a font from your pc and it generate an archive with your font in different formats and a css file. You need only to put the font files into a folder (such as fonts), copy the css code in your css file.

To use the new font you only need to use the “font-family” property:

@font-face {
    font-family: 'FontName';
    src: url('FontName.eot');
    src: url('FontName.eot?#iefix') format('embedded-opentype'),
         url('FontName.woff') format('woff'),
         url('FontName.ttf') format('truetype'),
         url('FontName.svg#StMarieThin') format('svg');
    font-weight: normal;
    font-style: normal;
}

body { font-family: FontName; }

I tested on the latest major browser:

  • IE 7/8/9
  • Firefox
  • Chrome
  • Safari
  • Opera

The website also contain a list of free commercial fonts you can embed in your pages.

Why use Modernizr?

Modernizr is a Javascript library that detects the features your browser can support, like HTML 5 and CSS3 .It let you manage what to do if the browser don’t show something in the right way.
This library use different approach than detect the browser type, it detects if the specific features are natively implemented. Modernizr aims to bring an end to the UA sniffing practice. Using feature detection is a more reliable way to establish what you can and cannot do in the current browser.

How to use it

First thing to do is to include it into your page “head” tag (download):

<script type="text/javascript" src="modernizr.js"></script>

Modernizr.load()

Modernizr.load is a resources loader (Js and CSS) that let you manage what to load. The sintax is pretty easy, is based on yepnope , an asynchronous conditional resource loader script.

Modernizr.load({
	test : Modernizr.canvas,
	yep : 'canvas.js',
	nope : ['no-canvas.js', 'no-canvas.css']
});
  • test: here you put the condition of test.
    List of CSS features
    List of HTML5 features
  • yep: if the condition is true you can load one or more js or css file.
  • nope: if the condition is false you can load one or more js or css file.

Modernizr CSS

Modernizr also put classes to the “html” tag letting you handle how to show something directly from css.

This example show you how display a div with the shadow if the browser support the “box-shadow” property, otherwise is displayed with a border.

.box {
   border-bottom: 1px solid #666;
   border-right: 1px solid #777;
}
.boxshadow div.box {
   border: none;
   -webkit-box-shadow: #666 1px 1px 1px;
  -moz-box-shadow: #666 1px 1px 1px;
   box-shadow: #666 1px 1px 1px;
}

In the case of the browser supports it Modernizr will add the class “boxshadow” to the “html” tag so you can use it to distinguish if the property can be used.

Modernizr

Google Webfonts

Google Webfonts is a collection of Hundreds of free, open-source fonts optimized for the web.
In just 2 quick steps you can have your special font into your site.

All of the fonts are Open Source, you can make your own collection and your are free to share your favorites with friends and colleagues.

Try to give a look!

eXtplorer web-based File Manager

EXtplorer is a PHP and JavaScript based File Manager. It has a directory tree with asynchronous loading of subdirectories with which you can move, copy or delete file and directories. It let you create or extract archives, the fastes way to upload multiple file. You can also manage different users with different permission levels.

It’s easy to install, you only need few steps:

  • Download latest version
  • Create a subdirectory in your server (example /extplorer)
  • Set up the correct permission (chmod 777)
  • Upload all eXtplorer files from your computer into the subdirectory on the server
  • Browse to the URL http://YOURSERVER/extplorer and login (user: admin, pass: admin).
    Remember to immediately change the admin password.

EXtplorer needs at least PHP 4.3 on the server and an up-to-date browser with Javascript enabled to run.

eXtplorer

Javascript get letter from KeyCode

I had need to create a javascript function that you give keyCode and it returns the respective char.

$(document).keydown(function (evt){
	var l = getLetterFromKey(evt.keyCode);
	if(l){
		alert(l);
	}
})

var letters = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
function getLetterFromKeyCode(keyCode) {
    if (keyCode >= 65 && keyCode <= 90)
        return letters[(keyCode-65)];
    return false;
}

SyntaxHighlighter – What is?

In this blog I had need to post pieces of codes, to show them it in the correct way I searched a syntax highlighter WordPress plugin.

I have tried some WordPress plugin until I found SyntaxHighlighter Evolved.

Using it I discovered that this plugin is based on SyntaxHighlighter by Alex Gorbatchev, a syntax highlighter developed in JavaScript. It’s currently used by Apache, Aptana, Mozilla, Yahoo, WordPress, Bug Labs, Freshbooks and others.

Random posts