This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready( function() { | |
$('#ClickWordList li').click(function() { | |
$("#txtMessage").insertAtCaret($(this).text()); | |
return false | |
}); | |
$("#DragWordList li").draggable({helper: 'clone'}); | |
$(".txtDropTarget").droppable({ | |
accept: "#DragWordList li", | |
drop: function(ev, ui) { | |
$(this).insertAtCaret(ui.draggable.text()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
<head> | |
<title>jQuery Examples for insertAtCaret</title> | |
<style type="text/css" media="Screen"> | |
#maincontainer { | |
width: 960px; | |
margin: 0 auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Building a router</title> | |
<script> | |
// Put John's template engine code here... | |
(function () { | |
// A hash to store our routes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$html = <<< HTML | |
<body> | |
<h1>Hello, | |
<b>world!</b> | |
</h1> | |
</body> | |
HTML; | |
$dom = new DOMDocument; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$selfClosing = explode(',', 'area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed'); | |
$html = ' | |
<p><a href="#">foo</a></p> | |
<hr/> | |
<br/> | |
<div>name</div>'; | |
$dom = new DOMDocument(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Sluggify - Simple Logic to turn a string to slug url | |
* To covert a string to SEO friendly | |
*/ | |
$title = "To covert a string to SEO friendly" | |
$slugs = preg_replace('/\%/',' percentage',$title); | |
$slugs = preg_replace('/\@/',' at ',$slugs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$post_id = array((object) (array( | |
'index_id' => 'Mahfuz', | |
)), (object) (array( | |
'index_id' => 'mstmhaque@gmail.com', | |
)), (object) (array( | |
'index_id' => 142, | |
))); | |
foreach ($post_id as $key => $value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* get mime data of the file. | |
* @return {String} mime-type of the given file | |
* @param $filename String | |
*/ | |
function get_mime($filename){ | |
preg_match("/\.(.*?)$/", $filename, $m); # Get File extension for a better match | |
switch(strtolower($m[1])){ | |
case "js": return "application/javascript"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// requires php5 | |
define('UPLOAD_DIR', 'images/'); | |
$img = $_POST['img']; | |
$img = str_replace('data:image/png;base64,', '', $img); | |
$img = str_replace(' ', '+', $img); | |
$data = base64_decode($img); | |
$file = UPLOAD_DIR . uniqid() . '.png'; | |
$success = file_put_contents($file, $data); |
OlderNewer