Skip to content

Instantly share code, notes, and snippets.

@partageit
partageit / aliases
Created November 20, 2014 10:00
My cmder aliases
ll=ls -l --color $*
phpdoc=php "C:\Program Files\phpDocumentor\bin\phpdoc.php"
vi=vim $*
md2html=markdown-html -s "~\Documents\md.css" -w $1 -o $1.html
composer=php "~\Documents\composer.phar" $*
@partageit
partageit / Gruntfile-copy-font-files.js
Last active August 29, 2015 14:08
Partage-it.com : inclure les fichiers font (de Font Awesome par exemple) avec grunt build (avec yo angular par exemple)
[...]
// The following *-min tasks produce minified files in the dist folder
cssmin: {
options: {
root: '' // customisation to add font files from CSS libraries
}
},
[...]
copy: {
@partageit
partageit / gmtToLocaleDate.js
Created November 1, 2014 21:30
Translate GMT date to browser's timezone, with locale format
/**
* 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) {
@partageit
partageit / functions-bootstrap-grid-shortcode.php
Created October 17, 2014 08:34
Partage-it.com : ajouter un système de colonnes responsives par shortcode pour WordPress
<?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
@partageit
partageit / loginControllers.js
Last active August 29, 2015 14:06
Partage-it.com : transformation de callback en promises
'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');
@partageit
partageit / blueimp-yeoman-angularjs-Uploader-v2.js
Created September 16, 2014 19:22
Partage-it.com : le contrôleur d'upload amélioré pour blueimp-file-upload
'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) {
@partageit
partageit / blueimp-yeoman-angularjs-main.html
Last active August 29, 2015 14:06
Partage-it.com : la vue pour blueimp-file-upload
<form id="fileupload" method="POST" enctype="multipart/form-data" ng-controller="UploaderCtrl" file-upload="options" ng-class="{'fileupload-processing': processing() || loadingFiles}">
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="row fileupload-buttonbar">
<div class="col-lg-7">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button" ng-class="{disabled: disabled}">
<i class="glyphicon glyphicon-plus"></i>
<span>Add files...</span>
<input type="file" name="files[]" multiple ng-disabled="disabled">
</span>
@partageit
partageit / blueimp-yeoman-angularjs-FileDestroy.js
Created September 11, 2014 12:08
Partage-it.com : le contrôleur de suppression de fichiers pour blueimp-file-upload
'use strict';
angular.module('testBlueimpApp')
.controller('FileDestroyCtrl', function ($scope, $http) {
var file = $scope.file,
state;
if (file.url) {
file.$state = function () {
return state;
};
@partageit
partageit / blueimp-yeoman-angularjs-Uploader.js
Created September 11, 2014 12:07
Partage-it.com : le contrôleur d'upload pour blueimp-file-upload
'use strict';
angular.module('testBlueimpApp')
.controller('UploaderCtrl', function ($scope, $http) {
var uploadScriptUrl = 'http://localhost/test-upload/index.php';
$scope.options = {
url: uploadScriptUrl
};
$scope.loadingFiles = true;
$http.get(uploadScriptUrl)
@partageit
partageit / functions-bootstrap-carousel-shortcode-v2.php
Last active August 29, 2015 14:04
Partage-it.com : amélioration du shortcode du carrousel d'articles pour WordPress avec Twitter Bootstrap