Joined June 2012
·
Posted to
Convert A Title Into Url Slug
over 1 year
ago
You're missing special chars here. The title "Der süße Vogel isst Flöhe" would become der-s-e-vogel-isst-fl-he
. You could omit special chars in general with something like this: encodeURIComponent('<some string>'.replace(/\s+/g, '-')).replace(/\%.{2}/g, '')
, but actually the best solution is to replace every special char with an appropriate ASCII equivalent, like: '…'.replace(/ä/ig, 'ae')
.
Additionally you could use this.value
instead of $(this).val()
. There' no need to instantiate a jQuery-object.
Posted to
Simple JavaScript detection for your CSS
over 1 year
ago
Useful tip!
Btw: instead of document.getElementsByTagName("html")[0]
you can use document.documentElement
.
Achievements
125 Karma
2,257 Total ProTip Views
Mongoose
Have at least one original repo where Ruby is the dominant language
Walrus
The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos
Altruist
Increase developer well-being by sharing at least 20 open source projects
Nephila Komaci 3
Have at least three original repos where PHP is the dominant language
Cub
Have at least one original jQuery or Prototype open source repo
Nephila Komaci
Have at least one original repos where PHP is the dominant language
Forked
Have a project valued enough to be forked by someone else
Charity
Fork and commit to someone's open source project in need
Honey Badger
Have at least one original Node.js-specific repo
Big accessibility fail! Makes me sad to see this nonsense gets promoted by the official Coderwall twitter-account … :-(