Dev Unleashed
JavaScript get the integer from the string
var str = 'abcd1234';
var number = str.match(/\d+$/);
number = parseInt(number, 10);
How to check if an enter key is pressed with jQuery
To check if an “ENTER" key is pressed inside a textbox, just bind the keypress() to the textbox. The "ENTER" key is represent by code “13″.
	var keycode = (event.keyCode ? event.keyCode : event.which);
	if(keycode == '13'){
		//do something	
Define an Array as CONSTANT with define
There is a simple way to define an array of values as constant… just
define ("constant-name","value1,value2,value3,value4");

$t_array = preg_split('/,/', constant(constant-name), -1, PREG_SPLIT_NO_EMPTY);


array(4) { [0]=> string(6) "value1" [1]=> string(6) "value2" [2]=> string(6) "value3" [3]=> string(6) "value4" }
Now you can iterate over the array defined as constant …
JavaScript’s “in” operator to simplify redundant logical ORs
Example of using the JavaScript “in” operator to reduce a series of logical ORs. Obviously this can be expanded, but the point is present. The “in” operator construct (x in y -or- prop in object) checks to see if x is a property of y.
if ( foo == "bar" || foo == "foobar" || foo == "foo" )

// can be written as
if ( foo in { bar:1, foobar:1, foo:1 } )
Sorting MySQL rows using column values
In MySQL it is easy to sort rows by using the ORDER BY clause on the column name. But if the requirement is to sort rows using column values rather than the name, then MySQL ‘field’ function would be helpful to you as explained below:
...field( column_name, value1, value2, value3...)
For example:
...ORDER BY field(status, 'Paid', 'Unpaid', 'Cancelled') DESC
MySQL: Checking size on multiple mysql tables and schemas
You could use the SHOW TABLE STATUS command in MySQL. If you go to your MySQL prompt and select a database, then use the SHOW TABLE STATUS command, like this:
show table status like '%';
you’ll find a column called Data_length which tells you “the length of the data file” for each table. If you simply add the size of each table in the database together, you should have the size of the whole database. If you run the query which is given below in MySQL Query Browser then you will get the two columns first will display the Data Base Name and the second will display the Data Base Size in MB.
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ; 
If you have question in your mind like “How to view the Free space available for my Data Base in MySQL”, then run the below query:
SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;
Moving MultiSelect values to another MultiSelect Using jQuery
$().ready(function() {
 $('#add').click(function() {
  return !$('#select1 option:selected').remove().appendTo('#select2');
 $('#remove').click(function() {
  return !$('#select2 option:selected').remove().appendTo('#select1');
Select all options in a Multiple Select Listbox Using jQuery
$("#select option").attr("selected","selected");
Kohana 3: Unable to find a route to match the URI
If you get Unable to find a route to match the URI: /some/uri/path/args on Kohana 3 when attempting to request a action with more than one paramter, you will need to update the code in /application/bootstrap.php:
Route::set('default', '(<controller>(/<action>(/<id>(/<overflow>))))', array('overflow' => '.*?'))
		'controller' => 'home',
		'action'     => 'index',
PDF reader in html
You could use an iFrame or something along with Google Docs Viewer. They have url instructions, pretty simple.
Technical Documentation - Instructions for building your own URLs

All viewer URLs should use the path . This path accepts two parameters:

url : The URL of the document to view. This should be URL-encoded.
embedded : If set to true , the viewer will use an embedded mode interface.

For example, if you wanted to view the PDF at the URL , you would use the URL: