Remove carriage returns from DOS-formatted text files using Vim
If you need to strip carriage return characters from a text file, you can use Vim:
vim file.txt
:set ff=unix
:wq
Related cards:
Strip carriage returns in submitted textareas
When submitting textarea
s, browsers sometimes include carriage returns (\r
) instead of just line feeds (\n
) at the end of each line. I don't know when this happens, and most of the time it doesn't matter.
In cases where it does matter, us...
Matching line feeds with regular expressions works differently in every language
Although regular expression syntax is 99% interchangeable between languages, keep this in mind:
- By default, the dot character (
"."
) does not match a line feed (newline, line break,"\n"
) in any language. - Some languages allow you to mo...
Remove resource fork files from a FAT volume on MacOS
Be careful!
The following solution will delete files on a volume. If you don't know exactly what you're doing, you can run into big trouble with your computer.
I play mp3 files on my car stereo that are stored on a SD-C...
Use -webkit-line-clamp to natively truncate long (multi-line) texts with an ellipsis
Note: You won't need this for single lines of text. In this case it is better to just use the text-overflow
property: Use CSS "text-overflow" to truncate long texts
You can use -webkit-line-clamp
in your CSS/SA...
jQuery: How to remove classes from elements using a regular expression
jQuery's removeClass
removes the given class string from an element collection. If you want to remove multiple/unknown classes matching a given pattern, you can do that.
For example, consider a DOM node for the following HTML. We'll reference i...
How to not leave trailing whitespace (using your editor or Git)
There is no reason to leave trailing whitespace characters in your project's files, so don't add any.
A git diff --check
will tell you if there are any and you should not commit when you see them. So go ahead and switch your editor/IDE to autom...
Remove duplicate lines from a text file
You can use this shell command:
uniq -u input.txt output.txt
Restangular: How to remove an element from a collection without breaking restangular
So you have a restangular collection and you want to remove an element from it, after you've successfully deleted it from the server.
The README [suggests](https://github.com/mgonto/restangular#how-do-i-ha...
Linux: How to print PDF files from the command line
Sometimes you may want to print files from the command line, especially when you have lots of them.
You can use lp
for that.
To print a single example.pdf
file on your default printer, simply say:
lp example.pdf
lp
accepts multipl...
Fix multiple CKEditor instances using jQuery adapter - fixed since 4.2
Using the jQuery adapter breaks the built-in save function of CKEditor.
Phenomenon: The page is submitted correctly, but the original values of the form fields were posted instead of what was typed in the editors.
Work around: Basicly in...