Kevin Pirnie' Articles

    Home / Archives for February 2013
Since I forget about this all the time, and continually have to look it up, I thought I would post this priceless resource.   Here is how to Copy/Paste while in a Ubuntu Server Shell (or command), while using the text editor 'Nano' Use the Alt-6 key combination to copy text to the "cut buffer". Similarly, use the Ctrl-K key combination to delete text (it is cut to the "cut buffer"). If no text is marked, these two commands copy or cut the entire line of text. Use the Ctrl-U key combination to paste the text in the "cut buffer" into the file. To cut or copy specific text, you must first mark the start and end points of the text you want to select. You can do this with the… Read More
I recently worked on a custom CMS project, where one of the requirements was to make the first sentence of each paragraph on each page render bold.While there is no 100% sure-fire way to do this, I found the following very helpful in achieving what I was after.First and Foremost, the function that does the dirty work: function bold_first_sentence($string) { $retStr = ''; preg_match_all('/(?<=[.?!]|^).*?(?=([.?!]).{0,3}[A-Z]|$)/s', $string[1], $matches); $mCt = count($matches[0]) - 1; for($i = 0; $i < $mCt ; ++$i){ if($i === 0){ $retStr .= '<strong>' . trim($matches[0][$i]) . $matches[1][$i] . '</strong> '; }else{ $retStr .= trim($matches[0][$i]).$matches[1][$i] . ' '; } } return '<p>' . $retStr . '</p>'; } Now, since the CMS utilizes classes to render all it's content, we had to make a slight… Read More