This file contains 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
'use strict'; | |
angular.module('testBlueimpApp') | |
.controller('UploaderCtrl', function ($scope, fileUpload) { | |
var baseUrl = 'http://localhost/test-upload/index.php'; | |
$scope.options = { | |
autoUpload: true, | |
maxChunkSize: 1024 * 1024, // = 1Mo | |
add: function(e, data) { |
This file contains 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
'use strict'; | |
angular.module('promiseTestApp') | |
.controller('LoginWithCallbacksCtrl', function ($scope, Connection) { | |
$scope.connect = function(login, password) { | |
$scope.showLoader(); | |
Connection.get( | |
{'login': login, 'password': password}, | |
function() { // success | |
$scope.notification('Connection successful'); |
This file contains 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 | |
/** | |
* Shortcodes to create responsive columns in the WordPress content, using Twitter Bootstrap. | |
* For further details about sizes, offset and clearfix, take a look at http://getbootstrap.com/css/#grid | |
*/ | |
/** | |
* Shortcode to add a row containing columns | |
* Parameters: | |
* - classes: additional classes |
This file contains 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
/** | |
* Get a date as 'YYYY-MM-DD HH:MM:SS' as GMT, and returns the same date according to the browser's timezone, i.e. GMT+n. | |
* The returned date is a string, with the locale format. | |
* @param string dateString The date as 'YYYY-MM-DD HH:MM:SS' | |
* @param bool withHour If false (default), the 'hour' part is excluded from the returned string | |
* @return string The date/time according to the browser's locale timezone and format. | |
* @example gmtToLocaleDate('2014-10-31 21:52:17', true) returns '31/10/2014 21:52:17' (according to my French browser locale, as october is GMT+1) | |
* @example gmtToLocaleDate('2014-05-31 21:52:17', true) returns '31/05/2014 23:52:17' (as May is GMT+2) | |
*/ | |
var gmtToLocaleDate = function(dateString, withHour) { |
This file contains 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 following *-min tasks produce minified files in the dist folder | |
cssmin: { | |
options: { | |
root: '' // customisation to add font files from CSS libraries | |
} | |
}, | |
[...] | |
copy: { |
This file contains 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
'use strict'; | |
/** | |
* Returns a clean copy of the provided object, in order to JSON.stringify it for example. | |
* | |
* It removes recursively methods and cyclic objects. | |
* Cyclic objects are references to a parent object of the property, for example: a.b.c = a; | |
* References to non-parent objects are kept, for example: a.b.c = 'hello'; a.d = a.b; | |
* @param any obj Any variable. When obj is not an object, it is returned as-is. | |
* @param array parents Parents list, for internal use. |
This file contains 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 | |
// src/UsersManager.php | |
namespace Vendor\Users; | |
class UsersManager { | |
private $users = array(); | |
/** | |
* Add a user to the list | |
* @return User|boolean Return the created user object, or false if the user is not valid |
This file contains 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 | |
/** | |
* Shift code to the left, preserving indentation. | |
* | |
* This is useful when reading code extract in a not-displayed nested structures. | |
* There is no use of closure here in order to remain compatible with older versions of PHP. | |
* This method is code agnostic. | |
* @example | |
* $code = ""; | |
* $code .= " while ($a) {"; |
This file contains 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 | |
// Add bootstrap, in order to be able to use its carousel feature | |
function enqueueStyles() { | |
wp_enqueue_style("bootstrap", get_stylesheet_directory_uri() . "/css/bootstrap/css/bootstrap.min.css"); | |
wp_enqueue_script('jquery'); | |
wp_enqueue_script('bootstrap-js', get_stylesheet_directory_uri() . '/js/bootstrap.min.js', 'jquery' ); | |
} | |
add_action("wp_enqueue_scripts", "enqueueStyles"); |
This file contains 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 | |
/* Custom gallery output */ | |
function customGalleryOutput($output = "", $attr) { | |
// This part is globally copied from the WordPress gallery function | |
$return = $output; // fallback | |
$post = get_post(); | |
if ( ! empty( $attr['ids'] ) ) { | |
// 'ids' is explicitly ordered, unless you specify otherwise. | |
if ( empty( $attr['orderby'] ) ) |