Skip to content

Instantly share code, notes, and snippets.

View srinathweb's full-sized avatar

srinath madusanka srinathweb

View GitHub Profile
$(document).ready(function(){
$('.btn').popover();
$('.btn').on('click', function (e) {
$('.btn').not(this).popover('hide');
});
});
@srinathweb
srinathweb / jquery mobile detect
Created May 14, 2015 11:01
jquery mobile detect
if(window.innerWidth <= 800 && window.innerHeight <= 600) {
return true;
} else {
return false;
}
<script>
$("#test-popover").on("click", function(){
var anonymous_nickname = $("#id_nickname").val();
if (anonymous_nickname.length <= 2) {
$('#id_nickname').popover('show');
} else {
$('#id_nickname').popover('destroy');
}
http://graph.facebook.com/user_id/picture
https://graph.facebook.com/me/friends?access_token=[oauth_token]&fields=name,id,picture
$(document).ready(function() {
var ul = $("<ul>");
$("table tr").each(function(){
var li = $("<li>")
$("th, td", this).each(function(){
var p = $("<p>").html(this.innerHTML);
li.append(p);
});
ul.append(li);
})
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
RENAME table `wp_commentmeta` TO `wp_a123456_commentmeta`;
RENAME table `wp_comments` TO `wp_a123456_comments`;
RENAME table `wp_links` TO `wp_a123456_links`;
RENAME table `wp_options` TO `wp_a123456_options`;
RENAME table `wp_postmeta` TO `wp_a123456_postmeta`;
RENAME table `wp_posts` TO `wp_a123456_posts`;
RENAME table `wp_terms` TO `wp_a123456_terms`;
RENAME table `wp_term_relationships` TO `wp_a123456_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_a123456_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp_a123456_usermeta`;
<textarea id="foo">Some text</textarea>
<script type="text/javascript">
var textBox = document.getElementById("foo");
textBox.onfocus = function() {
textBox.select();
// Work around Chrome's little problem
textBox.onmouseup = function() {
// Prevent further mouseup intervention
5
down vote
Try adding the following to your layout .xml file within <reference name="head">
<action method="addJs">
<script>js/custom-script.js</script>
</action>
http://frontlinedev.com/image-paths-a-magento-how-to/
Media Images from Template (phtml) Files
Adding an image from the media folder:
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). 'subfolder/image.png'; ?>" />
*note Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) returns a path of www.yourwebsite.com/media
Another way to produce the same link is:
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK). 'media/subfolder/image.png'; ?>" />