Updates from May, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • Pablo Bandin 4:51 PM on 21 May 2012 Permalink | Reply  

    PHP array_key_exists key insensitive 

    Posted by someone nicknamed “imaginary” @ http://php.net/manual/en/function.array-key-exists.php

    array_key_exists(strtolower($key), array_change_key_case($search));
    

     
  • Pablo Bandin 11:18 AM on 20 May 2012 Permalink | Reply  

    Bootstrap Modal Auto Align 

    When using bootstrap's modal plugin, sometimes you might have aligments issues, to fix them:
    $('#youModal').modal().css(
                    {
                        width: 'auto',
                        'margin-top': function () {
                            return -($(this).height() / 2);
                        },
                        'margin-left': function () {
                            return -($(this).width() / 2);
                        }
                    })
    

     
  • Pablo Bandin 8:19 PM on 19 May 2012 Permalink | Reply  

    Compare jQuery DOM objects for equality 

    get(0) gives you a reference to the raw DOM element. Just adding this to help someone else in case this post gets googled it by someone.

    var A = $('#divA');
    var B = $('#divA');
    
    if( A.get(0)===B.get(0) ){
        alert('A === B');
    }
    

     
  • Pablo Bandin 7:52 PM on 14 May 2012 Permalink | Reply  

    Signal.js 

    A little class i made to handle the dispatch of events and signals. Very easy but flexible.

    https://github.com/P48L0/signal.js/blob/master/signal.js

     

     

     
  • Pablo Bandin 1:35 PM on 12 May 2012 Permalink | Reply  

    CSS Transitions 

    This one i never used it up until today… i thought it was some crazy hacky thing, but it’s actually really cool.
    Basically, you add this attribute to the element that you want to animate, it takes 2 parameters (that i know of):

    1. The CSS property’s name that you want to animate of the current selector.
    2. THe time that the animation will take to execute.

    The code below will animate an anchor tag from a RED background to a GREEN background when you hover the mouse over it:
    On hover, the background will change to green, which will trigger the transition.

    a {
                    background:red;
    		transition:background 1s;
    		-moz-transition:background 1s; /* Firefox 4 */
    		-webkit-transition:background 1s; /* Safari and Chrome */
    		-o-transition:background 1s; /* Opera */
    }
    a:hover { background:green; }
    

    Live example here: http://www.w3schools.com/css3/tryit.asp?filename=trycss3_transition1

     
  • Pablo Bandin 10:15 PM on 8 May 2012 Permalink | Reply  

    one of those things… 

    I’m working on my website and i got a very weird error… for some reason all the javascripts on my page were being re-loaded when i attempted to load some module via ajax… it was very weird…

    then, after some code sniffing, i found the error… i forgot to close a DIV tag, so i was appending that DIV to the BODY and because it was open, it was eating all the page, so i was actually adding all the body to itself again, meaning, all the SCRIPTS tags were adding itself again, hence the reload (im using jquery)

    Anyway… back to coding…

     
  • Pablo Bandin 12:11 PM on 25 April 2012 Permalink | Reply  

    momentjs is awesome! 

    I just wanted to say that this library http://momentjs.com/ is totally awesome! If you dont know it yet, check it out, read the documentation and enjoy!

     
  • Pablo Bandin 9:06 PM on 16 April 2012 Permalink | Reply  

    The Phonecall 

    An animation i made yesterday: http://www.newgrounds.com/portal/view/593867

     
  • Pablo Bandin 1:23 PM on 11 April 2012 Permalink | Reply  

    [workaround] IE8 + execCommand + createLink = Not working 

    I was trying to generate a link, and open a custom user interface to generate eventualy the src of the link, but for some reason IE8 wasn´t generating the link using execCommand. But the createImage command WAS working… so my workaround was this (i was using t his from inside a NiceEdit plugin)

     

     

            this.ne.nicCommand("insertImage", "dummy");
            
            var hook = $("<a href='#' class='hidden'></a>").appendTo("body");
            
            $("img[src='dummy']").after( hook ).remove();
    
    

    from that point on, i have a reference to the created link, and i can do whatever i want with it.

     
  • Pablo Bandin 10:33 AM on 5 April 2012 Permalink | Reply  

    Library Batch Prefix for CS5 

    I made this library a while ago http://tracehello.wordpress.com/2009/10/29/flash-library-batch-rename-prefix/ and today i was trying to install it on CS5… using the Extension Manager wasnt enough… because it was made for CS4 it will install the files on the folder CS4 asosiated with your user folder…

    to add it to CS5 just:

    1. search for Libray Batch Prefix.swf on C:\Users\YOUR_USER\AppData\Local\Adobe\Flash CS4\YOUR_LANG\Configuration\WindowSWF
    2. Copy that file to: C:\Users\YOUR_USER\AppData\Local\Adobe\Flash CS5\YOUR_LANG\Configuration\WindowSWF

    If you have multiple language folders, just copy the file on all of the variations of the root above. Just to be sure… Then, restart flash cs5 and you should see the panel on the menu > window > other panels
    This panel is really usefull when you have to do repetitive work… and everybody knows how anoying is to copy and paste symbols from diferent movies and have to deal with the overlaping of names… (if you are like me and dont name each asset as you create them… eg: Tween1, Tween2… Symbol1, Symbol2, lol…)
    :)
    PS: im using Widnows 7, but the logic is the same, find the matching root on your operating system… the easyest solution is to just find Library Batch Prefix.swf on your computer and get the roots from there…
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.