4th
Lately I needed a function to round down a string to the closest “word” and I couldn’t find one. Here’s my crack at it in PHP.
Params are the string, maximum characters not to be exceeded, and optionally, the trailing characters (common one I would choose is an elipsis “…” ). If you think of a better way, let me know.
function roundStringDown($string, $maxCharacters, $trailingCharacters = ""){
if(strlen($string) > $maxCharacters){
$string = substr($string, 0, $maxCharacters);
$string = substr($string, 0, strripos($post, " ")).$trailingCharacters;
}
return $string;
}
I haven’t posted in a while, I’ve been so busy! I moved to NYC, and started a new Job. I’m a front-end developer at Buddy Media. We deal primarily with the social net and marketing.
I really like it so far, the Buddy Media team is really sharp, and everyone is approachable.
I’ve adjusted to life in the city pretty well; I feel like my new apartment is “home” now.
Hijax is a simple approach in web development where you basically create all your functionality as you would 10 years ago, ie: each click does a full page refresh, and then add in some non-obtrusive javascript to effectively hijack each click (stop the page reload), and go on to handle the event (send off an XHR). And as the brits say… Robert’s Your Father’s Brother… you get your cool Ajax-ified app but it’s usable by peeps with no javascript.
This presentation describes making your apps usable for all, cool for some, instead of just cool for some.
http://domscripting.com/presentations/xtech2006/
I am definitely keeping this is mind for future development.