This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Main script file --> | |
<!-- when JSON object is received it's passed to template (id of script tag) --> | |
<!-- posts in the end is JSON object we received from AJAX --> | |
var template = _.template( $("#posts_template").html(), posts ); | |
<!-- in HTML document --> | |
<!-- emplty placeholder --> | |
<div id="posts-container"></div> | |
<!-- compiled template adds html to empty placeholder --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = _.template($('#template-in-script').html()); | |
$('#placeholder-container').html(template(data)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dfd = $.Deferred(); | |
var endpoint = $.ajax({ | |
url: 'http://yourdomain.com/data.json', | |
sucess: dfd.resolve | |
}); | |
endpoint.success(function(data){console.log(data)}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* wp_signon can only be executed before anything is outputed in the page because of that we're adding it to the init hook */ | |
global $wppb_login; | |
$wppb_login = false; | |
function wppb_signon(){ | |
global $error; | |
global $wppb_login; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blog: function(){ | |
$.ajax({ | |
url: 'http://alexbachuk.com/api/get_recent_posts/', | |
type: 'GET', | |
dataType: 'json', | |
success: function(data){ | |
console.log(data); | |
}, | |
error: function(data){ | |
console.log(data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(exports, document, $) { | |
var window = exports; | |
var RecentGiftsController = function(mediator) { | |
var mediator = mediator; | |
var pollingProcess = null; | |
var url = '/ajax/get-recent-gifts'; | |
var buffer = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// PHONEGAP + jQUERY MOBILE (page from android app) | |
$(document).on("pageinit", ".ui-page", function () { | |
$('input').focus(function(){ | |
$('#signin-footer').hide(); | |
}); | |
$('input').blur(function(){ | |
$('#signin-footer').show(); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NAMESPCING APP | |
var App = { | |
Models : {}, | |
Collections: {}, | |
Views: {}, | |
Router: {} | |
}; | |
//DECLARING MODEL | |
App.Models.Post = Backbone.Model.extend({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$meta_boxes[] = array( | |
'id' => 'home_page_metabox2', | |
'title' => 'Preview', | |
'pages' => array( 'page', ), // Post type | |
'context' => 'normal', | |
'priority' => 'high', | |
'show_names' => true, // Show field names on the left | |
'show_on' => array( 'key' => 'page-template', 'value' => 'page_home.php' ), | |
'fields' => array( | |
array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if gte mso 9]> | |
<v:image xmlns:v="urn:schemas-microsoft-com:vml" id="theImage" style='behavior: url(#default#VML); display: inline-block; position: absolute; width: 374px; height: 246px; top: 0; left: 130px; border: 0; z-index: 1;' src="/imgs/myPhoto.png" /> | |
<v:shape xmlns:v="urn:schemas-microsoft-com:vml" id="theText" style='behavior: url(#default#VML); display: inline-block; position: absolute; width: 374px; height: 246px; top: -5; left: 125px; border: 0; z-index: 2;'> | |
<div> | |
<![endif]--> | |
<table style="background: /imgs/myPhoto.png”> | |
</table> | |
<!--[if gte mso 9]> | |
</div> | |
</v:shape> |