Category: Quick Tip

  • How to add Bower component when it’s not in the repository?

    How to add Bower component when it’s not in the repository?

    Sometimes component that you want to use in your project isn’t available in Bower repo. There is a way to install it, even in very specified version. Go to project’s Github, in my case it’s here. Copy URL from the browser, and paste it somewhere. Now go to relases and click commit id that you’re interested […]

  • How to programmatically select option in a HTML list using jQuery?

    How to programmatically select option in a HTML list using jQuery?

    This is very simple solution to select specified option in a HTML select list. You just need to use the val function on a select element to set it’s value. It’s simple like that: $(‘select#identificator’).val(‘value of existing option value’); Check working example on the JSFiddle: http://jsfiddle.net/fedek6/B3Ehj/

  • How to check visibility state in jQuery toggle function?

    How to check visibility state in jQuery toggle function?

    Here is a quick tip how to check visibility state of a toggled element in jQuery: $(‘#element’).toggle(‘slow’, function() { if($(this).is(‘:hidden’)) { $(this).text(‘This element is hidden.’); } else { $(this).text(‘This element is visible.’); } });

  • Force Yii to republish assets every page refresh

    Force Yii to republish assets every page refresh

    During webapp development you’ll need often assets republication. When you publish assets using directory path, framework won’t republish them automaticaly. So what can you do? It’s plain simple. Use YII_DEBUG constant as fourth argument in publish function. $assetPath = Yii::app()->assetManager->publish(Yii::getPathOfAlias(‘application.modules.components.assets’), false, 1, YII_DEBUG); From this moment Yii will republish assets on every page refresh only […]

  • How to run application on specified interface?

    If you have two interfaces, you can run programs using one of them (despite the fact that Windows selects default interface based on a metric value). For example I virtualize Windows 7 and I need same static ip for it that my host computer uses. It’s OK, in this scenario I can run applications using […]

  • How to delete file permanently in Linux?

    Most of Linux distributions have shred already installed. So it’s really easy to delete a file in a secure manner: shred -u -z -n 26 topsecret.txt Meaning of used switches: -n [N] Overwrite a file N times. For example, -n 20 will perform twenty passes over the file’s contents. -u Remove the file after you’ve shredded it. […]