I came across a curious issue today. You can’t select a period of time over which to fade out and fade in Twitter Bootstrap buttons.
If you apply jQuery fadeTo() or animate() they fade out and they fade in, but they do it in their own time.
This may be related to a css transition which is applied in the bootstrap css, I haven’t had a chance to look, but the workaround for me is to put the button in a span and fade the span in and out instead.
<span><a href="#" class="btn small">Button Text</a></span>
Posted by Harry at 11:49 am on November 17th, 2011.
Categories: Javascript, jQuery.
Adding a new column to a table which needs to contain a different random hash for each row?
Mysql can easily generate md5 strings and update all rows in the table for you
UPDATE thetable
SET thecolumn = MD5(RAND())
WHERE thecolumn IS NULL
Posted by Harry at 9:37 am on November 1st, 2011.
Categories: MySQL.
fetchit-21
This technique produces something similar to the wiggle you get on an iPhone when deleting items.
Be aware that keyframe animation is still very poor in Chrome and cases freezing and jumping if multiple items are animated at once.
The animation css below results in a hovered element rotating back and forth around it’s centre point. You can update the number of degrees and length of animation to change the appearance.
Just add this css and give your element the class ‘wiggler’ to implement
/* safari and chrome */
@-webkit-keyframes wiggle {
0% {-webkit-transform:rotate(4deg);}
50% {-webkit-transform:rotate(-4deg);}
100% {-webkit-transform:rotate(4deg);}
}
/* firefox */
@-moz-keyframes wiggle {
0% {-moz-transform:rotate(4deg);}
50% {-moz-transform:rotate(-4deg);}
100% {-moz-transform:rotate(4deg);}
}
/* anyone brave enough to implement the ideal method */
@keyframes wiggle {
0% {transform:rotate(4deg);}
50% {transform:rotate(-4deg);}
100% {transform:rotate(4deg);}
}
.wiggler:hover {
-webkit-animation: wiggle 0.5s infinite;
-moz-animation: wiggle 0.5s infinite;
animation: wiggle 0.5s infinite;
}
Posted by Harry at 11:45 am on September 29th, 2011.
Categories: css, The Web.
fetchit-21
In case you weren’t aware, you can reorder the results you already have from a previous Yii call. For example…
$users = User::model()->findByPk(2);
$posts = $user->posts(array('order'=>' created Desc '));
There were just ordered our users posts by created date descending.
We can also do filtering…
$users = User::model()->findByPk(2);
$posts = $user->posts(array('condition'=>' status=1 '));
So now we only have active posts. We could also combine a condition and a status.
You can find out more here: http://www.yiiframework.com/doc/guide/1.1/en/database.arr#dynamic-relational-query-options
Posted by Harry at 1:13 pm on September 14th, 2011.
Categories: PHP, Yii.
fetchit-21
The example given on the Facebook developer documentation page ( http://developers.facebook.com/docs/reference/fbml/serverFbml/ ) doesn’t work. This one does.
Note how some html is escaped and the multi-friend-selector is inside the form.
The code below allows you to add the large version of a friend select in the form of an invite tool to your iframe facebook applications:
<fb:serverFbml style="width: 755px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action=""
method="post"
invite="true"
type="XFBML"
content="This is a test invitation from XFBML test app
<fb:req-choice url="see fb:req-choice docs for details."
label="Ignore the Facebook test app!" />
">
<fb:multi-friend-selector
showborder="false"
actiontext="Invite your friends to use Socially." />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverFbml>
Posted by Harry at 9:25 pm on September 4th, 2011.
Categories: Facebook, The Web.