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));
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));
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); } })
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');
}
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
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):
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
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…
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!
An animation i made yesterday: http://www.newgrounds.com/portal/view/593867
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.
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: