Skip to content

Instantly share code, notes, and snippets.

View coderdiaz's full-sized avatar
:electron:

Javier Diaz coderdiaz

:electron:
View GitHub Profile
<div class="form-group">
<div class="col-md-4">
<span class="api-input-ico icon-calendar3"></span>
<input type="text" class="form-control api-input-wico" id="datepicker">
</div>
</div>
// Input with icons
.api-input-ico {
@coderdiaz
coderdiaz / dates.js
Last active August 29, 2015 14:24
Order Dates on DataTables with format DD/MM/YY
$.fn.dataTable.ext.oSort['uk_date-desc'] = function( a,b ) {
var ukDatea = a.split('/');
var ukDateb = b.split('/');
var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
}
$.fn.dataTable.ext.oSort['uk_date-asc'] = function( a,b ) {
var ukDatea = a.split('/');
//
// Colour customisation
//
// Border between the header (and footer) and the table body
@table-header-border: 1px solid #111111;
// Border of rows / cells
@table-body-border: 1px solid #dddddd;
@coderdiaz
coderdiaz / history.php
Created June 9, 2015 14:38
Union ALL with Laravel 4.2
<?php
/**
* Funcion para obtener el historial sobre una cuenta, a partir de los trámites que ha realizado.
* @return Response JSONArray
*/
public function obtenerHistorialCuentas($account)
{
$depositos = TesDepositos::select(DB::raw('1 AS tipo,tes_depositos.deposito_id as folio, tes_depositos.deposito_importe as importe, tes_depositos.deposito_date_revision as fecha, tes_depositos.deposito_estado as estado'))
->distinct()
@coderdiaz
coderdiaz / app.js
Created June 4, 2015 03:15
Datepicker without Weekends
$('#fecha2').datepicker({
changeMonth: true,
changeYear: true,
showOn: 'button',
buttonImage: 'css/images/ico.png',
buttonImageOnly: true,
showButtonPanel: true,
beforeShowDay: $.datepicker.noWeekends
});
/* $cordovaCamera
* http://ngcordova.com/docs/plugins/camera/
*/
$scope.takepicture = function() {
var options = {
destinationType: Camera.DestinationType.FILE_URL,
quality: 90
};
$cordovaCamera.getPicture(options).then(function(imageData) {
@coderdiaz
coderdiaz / app.js
Created May 12, 2015 22:39
Obtener el tamaño de un objeto a partir de sus llaves
var var_object = {
'one': 'The first key',
'two': 'The second key',
'three': 'The third key'
};
var size_object = Object.keys(var_object).length;
console.log('The size is: ' + size_object); // The size is: 3 ;
@coderdiaz
coderdiaz / backup.js
Last active November 9, 2016 13:27
How to backup Database with Ionic Framework
/*
* Implementation with Ionic Framework with $cordovaFile plugin
* ngCordova.
*/
.controller('Ctrl', function($scope, $cordovaFile) {
$scope.backupDatabase = function() {
// Backup Database ;
var URI_DB = cordova.file.applicationStorageDirectory+'databases/';
<VirtualHost *:80>
ServerAdmin webmaster@admin
DocumentRoot /var/www/myproject.dev/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
@coderdiaz
coderdiaz / delete.sql
Last active August 29, 2015 14:18
How to delete duplicate rows with MySQL
DELETE n1
FROM table1 n1, table1 n2
WHERE n1.id > n2.id
AND n1.id_name = n2.id_name;
/*
* With this query you can
* delete the duplicate rows in one table (table1)
* ´WHERE n1.id > n2.id´ with this line you can keep the first row
* if you want keep the second row you need use ´WHERE n1.id < n2.id´