Posted on June 2, 2013 in Code, CSS #
This is such a simple but nice-to-have thing. I really like using normalize.css instead of having to completely wiping the styling of every element and I’ve to used my own mini reset with it to remove some of the default values like margins and paddings. I guess that I don’t have to do that anymore!
Posted on May 26, 2013 in Code, JavaScript
Earlier today I pushed a new project to Github called Helper.js. It basically a minimal1 JavaScript library for basic DOM manipulation tasks, which supports Internet Explorer 8 and above. It obviously ain’t as versatile as jQuery, but it gets the job done for simpler stuff. I’ve tried it out in some older browsers but it’s probably likely that it has some bugs and sharp edges. As always I mostly wrote it just for fun and to learn the ins and outs of working with the DOM and structuring objects and the like in JavaScript. After 380 lines of code I feel much more confident but still very much like a novice.
Posted on May 20, 2013 in Code, Vim
Here’s a handy function I came up with after being tired of using :cd ../ like a madman when I was deep down at the bottom of a project’s folder structure:
function! GoToRootDir()
if isdirectory(".git")|| filereadable("Rakefile") || filereadable("Gruntfile.js")
pwd
else
silent! exec 'cd ../'
call GoToRootDir()
endif
endfunction
It’s a not-so-fancy way of basically telling Vim to keep going up in the directory structure until it finds either a .git folder or a specific file. When it finds the root it’ll also print out the path, which I added so that you can actually see that you’re in the root of the project. You can of course change .git, Rakefile and Gruntfile.js to something completely different, as long as it’s a file that you commonly have in your projects. I also added a more convenient mapping for it in my .vimrc:
command! -nargs=0 Root call GoToRootDir()
This step may not be necessary, but by mapping something like :call GoToRootDir to just :Root means that you have to type fewer keystrokes.
Posted on May 14, 2013 in Code, CSS #
A nice and lengthy article about how to write modular and maintainable CSS. I especially like the naming conventions, mostly because they’re similar to my own. I’m vain like that.
Posted on May 9, 2013 in Vim, Code #
Lately I’ve really started to enjoy the Monokai theme. There’s a couple of different versions out there for Vim and my favorite is Monokai-Refined. However, Vim’s way of handling highlighting can sometimes be quite weird so I decided to add some minor tweaks so that it looks especially good when your writing HTML, CSS and JavaScript and make it available in a repository. I don’t know if it’ll replace my beloved Tomorrow Theme or Solarized, but it’s definitively a close third atleast.