Archive for Tips & Tricks

Fix DropDown Bug on mobile devices – Twitter Bootstrap

Yesterday I helped a colleague composing a new corporate website frontend heavily based on TwitterBootstrap.

There was a problem implementing a navigation menu with dropdown sub menus:
Dropdown’s items are not selectable on touch devices!

Surfing the web I found a lot of posts about this problem on stackoverflow and TW Git’s bug tracker… but no official solution is provided by TW team yet!

Hopefully I found a great post who provide a simple solution to this problem by adding a single line of code to the TwitterBootstrap’s dropdown javascript source!

// just append to link #142 of bootstrap-dropdown.js (2.2.1 branch)
.on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); })

Resources

Posted in Tips & Tricks | Leave a comment

LessC – LessCss Compiler Bugfix

Hi, as you may know CakePower embeds LessC to parse and compile LessCSS source files in a transparent way.

LessC is a PHP script, LessCss allows embedding javascript source code (just like a bookmarklet )so errors happens when you try to compile a LessCss source file who contains some js code.

Continue reading »

Posted in CakePOWER, Tips & Tricks | Leave a comment

Be careful on debug() and CakePHP Session!

Few days ago I spend about an hour on a very strange strange bug relating to usages of debug() utility.

I was implementing a CakeEventListener on a very simple controller.

I was thinking it was a bug… but it was just a consequence of CakePHP lazy-load initialization behavior!

Continue reading »

Posted in CakePHP, Tips & Tricks | 2 Comments

PhpCompiler – PHP deployment utility

Today I wrote an utility class to quick deploy my PHP based projects: PhpCompiler.

It copy all files from a /source path to a /-compiled path with these utility:

  • follows symlinks to create a ready to FTP deployed path
  • allow to skip files and folders by rules
  • optionally removes all comments from PHP files (by rules)
  • optionally uglify PHP files (by rules)

Continue reading »

Posted in Script, Tips & Tricks | 1 Comment

LessMixin – Write Less Do More with CSS!

I really love LessCSS who provide a new way to think to CSS and to write them using structures inherited from scripting languages.

I love mixins because allow to pack some reusable styles into a namespace then implement them into classes, tags, ids… and other mixins!

So I began to write some reusable mixins intended to make my life easier writing less and DRY code!

What can I do with LessMixin?

LessMixin is a work-in-progress project so features will grow up by time, it is hosted on GitHub so you can fork it and send your improvements to be included into LessMixin.

By now it offers features like:

Shortcuts

  • margin
  • padding
  • text-aligment

Box Model

  • sizing elements
  • block elements
  • compatible inline block
  • mask elements
  • absolute position

CSS3

  • border-radius utilities

Mishellaneous

  • creates sprites with ease
  • inline-list (for menus and other…)
  • highlight text
  • text 3D
Posted in Tips & Tricks | Leave a comment

CakePHP AuthComponent – refresh user data

In my authentication based project I have an Account Settings panel who allow authenticated user to change some profile data like e-mail, language and country.

All things works fine with CakePHP Model’s save() method but AuthComponent still provide old values because it stores user’s data into CakePHP SessionComponent at login time.

The problem is that when an authenticated user updates it’s profile then he need to logout then login to update session’s data.

Continue reading »

Posted in CakePHP, CakePOWER, Tips & Tricks | Leave a comment

How to create Text 3D effect with LessCSS – CSS3 Technique

Today I would share to you a smart mixin I created for LessMixin project hosted on GitHub to render 3D Text with a single line of code!

Continue reading »

Posted in Tips & Tricks | Leave a comment

Execute complex Javascript in LessCSS

Today I was playing with my public project LessMixin adding some cool features when I ran into a LessCSS limit: loops!

Loops – for, while – are not implemented yet (but the author said it will never be!).

Continue reading »

Posted in MovableApp.com, Script, Tips & Tricks | 2 Comments

Javascript Optimization: variable’s scope

Variables are places where you store values.
When doing some logics you always need to access variables.

Do you know accessing local variables is better than accessing globals?

Continue reading »

Posted in Script, Tips & Tricks | Leave a comment

Backbone: how to refresh a Router action

There is a little bug in BackboneJS Router’s logic: If you try to trigger the same route twice (or more) then linked action is triggered only once.

In this simple tutorial I tell you why this behavior happens and I propose a simple workaround to let things works. I also set up a jsFiddle example to demonstrate how this bug influence your app and the simple workaround to kill it.

Continue reading »

Posted in BackboneJS, Tips & Tricks | 4 Comments

Swedish Greys - a WordPress theme from Nordic Themepark.