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
function ellipsis(numOfWords, text, wordCount ) { | |
wordCount = text.trim().replace(/\s+/g, ' ').split(' ').length; | |
if(numOfWords <= 0 || numOfWords === wordCount){ | |
return text; | |
} else { | |
text = text.trim().split(' '); | |
text.splice(numOfWords, wordCount, '...'); | |
return text.join(' '); | |
} | |
} |
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
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.9.1.min.js"></script> | |
<script type="text/javascript"> | |
if (typeof jQuery == 'undefined') { | |
document.write(unescape("%3Cscript src='/js/jquery-1.9.1.min.js' type='text/javascript'%3E%3C/script%3E")); | |
} | |
</script> |
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 http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Your Website</title> | |
</head> | |
<body> | |
<header> | |
<nav> |
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
// Safely use $ | |
(function($) { | |
$.fn._ie_select=function() { | |
return $(this).each(function() { | |
var a = $(this), | |
p = a.parent(); |
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
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011 | |
* http://benalman.com/ | |
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ | |
(function($) { | |
var o = $({}); | |
$.subscribe = function() { | |
o.on.apply(o, arguments); |
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
jQuery.fn.replaceText = function( search, replace, text_only ) { | |
return this.each(function(){ | |
var node = this.firstChild, | |
val, | |
new_val, | |
remove = []; | |
if ( node ) { | |
do { | |
if ( node.nodeType === 3 ) { | |
val = node.nodeValue; |
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
$my_file = 'file.txt'; | |
unlink($my_file); |
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
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); | |
//write some data here | |
fclose($handle); |
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
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'a') or die('Cannot open file: '.$my_file); | |
$data = 'New data line 1'; | |
fwrite($handle, $data); | |
$new_data = "\n".'New data line 2'; | |
fwrite($handle, $new_data); |
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
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); | |
$data = 'This is the data'; | |
fwrite($handle, $data); |
OlderNewer