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
<?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
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
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
<!-- 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
$.fn.swipeEvents = function() { | |
return this.each(function() { | |
var startX, | |
startY, | |
$this = $(this); | |
$this.bind('touchstart', touchstart); |
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
// The actual grunt server settings | |
connect: { | |
options: { | |
port: 9000, | |
hostname: 'localhost', | |
livereload: 35729 | |
}, | |
proxies: [{ | |
context: '/api', // the context of the data service | |
host: 'mydomain.com/apis/', // wherever the data service is running |
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 | |
/* | |
Plugin Name: NDM metaboxes | |
Description: portfolio metaboxes for NDM | |
Version: 0.11 | |
Author: Alex Bachuk | |
Author URI: http://alexbachuk.com | |
License: GPL2 | |
*/ | |
?> |
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 add (a,b) { | |
return a+b; | |
} |
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
// Redux action | |
export function uploadSuccess({ data }) { | |
return { | |
type: 'UPLOAD_DOCUMENT_SUCCESS', | |
data, | |
}; | |
} | |
export function uploadFail(error) { | |
return { |