-
vim increase numbers fuction
1 " -----------------8<-----------------------
2 " from: http://rayninfo.co.uk/vimtips.html
3 " advanced incrementing (really useful)
4 " put following in _vimrc
5 let g:I=0
6 function! INC(increment)
7 let g:I =g:I + a:increment
8 return g:I
9 endfunction
10
11 " usage
12 " :%g/pattern/s/$/\=INC(1)/g
13 " -----------------8<----------------------- -
Multiple documents
You don't have to go up window-tab and choose the open document there, when you can simply press ctrl + tab, which changes your open document forward and backwards ctrl+shift+tab.
Helped me alot!
(not tested with PC) -
save characters & prevent conflicts
just a quick one that most will know, but for those that don't, use the followin g format for your plugins, jQuery or otherwise to avoid conflicts when the noConflict() call is made...ensures forward compatibility and saves you valuable characters!
it's a self invoking anonymous function, that passes the jQuery object in as a param to allow for inernal use of $, thus avoiding conflicts with other libraries.(function($){
})(jQuery);
-
Float bug fix in div to expand
HTML:
<div class="container">
<div class="inner_div">
blablabla <br> blablabla <br> blablabla<br>
</div>
</div>CSS:
.container{width:300px;background:red;}
.inner_div{float:left;width:200px;font:12px arial;}The red background in the container div will not expand when you add content to the inner div. So here is a simple trick to get the container div to expand.
Just add
.container{overflow:hidden;} -
List images from a folder automatically via PHP
// the directory, where your images are stored
$imgdir = '/images/';// list of filetypes you
$allowed_types = array('png','jpg','jpeg','gif'); want to show$dimg = opendir($imgdir);
while($imgfile = readdir($dimg))
{
if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
{
$a_img[] = $imgfile;
sort($a_img);
reset ($a_img);
}
}
// total image number
$totimg = count($a_img);for($x=0; $x < $totimg; $x++)
{
$size = getimagesize($imgdir.'/'.$a_img[$x]);// do whatever
$halfwidth = ceil($size[0]/2);
$halfheight = ceil($size[1]/2);
echo '
<li><img src="%27.$imgdir.%27%27.$a_img%5B$x%5D.%27"></li>';
} -
Aspect ratio and scaling images
If you are making an image scalable using css, for example:
img { width: 100%; }
it is worth also setting the adjacent dimension to auto, overiding any previously defined value:
img { width: 100%; height: auto; }
This will maintain the aspect ratio of the image and stop it from being stretched or squashed.
-
Boost SEO by submitting your website on Web Gallerys
CSS & PHP galleries need web submissions to survive and keep their web browsers coming back to 'borrow' ideas from other web designers. Submit your idea to these galleries and if you're featured you'll get bumped up search engine free ranking listings. I've had over 2500 visitors in less than 5 weeks and from being the last man standing in the rankings have catapulted to no.1 on Bing and Google for keyword 'Ronnie Wright' - Ah! Vanity is a wonderful thing. You can see a list of the galleries I submitted to and a vid on my website - it's free traffic for 10mins work, get in! Before you think it I'm not a web gallery owner or bot, I'm a human that calls himself a designer.
-
Use jQuery instead of $ in plugins
Whenever you happen to write your own plugin, always remember to use jQuery instead of $ to refer to the library, the reason being jQuery usage makes for a correct noConflict() call.
-
Page break before comments
Not everyone wants to print your blogged article AND comments too.
Add "page-break-before: always" to your CSS code for #comments to add a page break at the end of the article. -
Keep a Design Scapbook
Keep a online scapbook of website designs/elements that you enjoy. Then refer to it when you need some inspiration (don't copy mind!).
I tend to use Flickr (http://www.flickr.com/photos/31361323@N02/) because you can tag images and add notes directly to the screenshots.
I use ScreenGrab to take screenshots of websites:
https://addons.mozilla.org/en-US/firefox/addon/1146A good tip is to only take shots of the particular element you enjoy. This helps some people avoid the temptation to copy whole websites!

