Skip to content

Instantly share code, notes, and snippets.

@arodu
arodu / bootstrap_enable_link2tab.js
Created May 31, 2016 19:32
Javascript to enable link to tab
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function ( e ) {
window.location.hash = e.target.hash;
})
@arodu
arodu / bootstrap_cake_pagination.php
Created June 11, 2016 11:28 — forked from thomseddon/bootstrap_cake_pagination.php
Bootstrap style CakePHP pagination
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
));
?>
</p>
<ul class="pagination">
<?php
echo $this->Paginator->prev('&laquo;', array('tag' => 'li', 'escape' => false), '<a href="#">&laquo;</a>', array('class' => 'prev disabled', 'tag' => 'li', 'escape' => false));
@arodu
arodu / selec_dependent.md
Last active April 20, 2019 17:59
Select Dependents CakePHP 3.x

Add function selectList in the controller

<?php
  // in the Controller
	
	// ...
	public function selectList($type_list, $ref_id = null){
		if($type_list == 'provinces' && $ref_id != null){
			$list = $this->Provinces->find('list')
				->where(['country_id'=>$ref_id])
@arodu
arodu / .htaccess
Created July 28, 2016 13:37
Quitar el index.php en las url de CodeIgniter
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
@arodu
arodu / .htaccess
Created August 2, 2016 21:50
Cache del lado del Navegador
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
#
# These are pretty far-future expires headers
# They assume you control versioning with cachebusting query params like:
# <script src="application.js?20100608">
# Additionally, consider that outdated proxies may miscache
#
@arodu
arodu / see_errors.php
Created August 9, 2016 15:21
Mostrar errores de PHP en tiempo de ejecución
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
// Code...
?>
@arodu
arodu / mobileDetect.js
Created August 14, 2016 01:55
Detectar mobile con javascript
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
@arodu
arodu / README.md
Created August 15, 2016 22:24 — forked from hofmannsven/README.md
My simple SCSS Cheatsheet
@arodu
arodu / longPolling.js
Created August 18, 2016 16:18 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
@arodu
arodu / index.html
Created August 18, 2016 18:53
Multiple open bootstrap modal
<h2>Stacked Bootstrap Modal Example.</h2>
<a data-toggle="modal" href="#myModal" class="btn btn-primary">Launch modal</a>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal 1</h4>