Skip to content

Instantly share code, notes, and snippets.

View sanPuerquitoProgramador's full-sized avatar

Iván Cabrera sanPuerquitoProgramador

View GitHub Profile
@sanPuerquitoProgramador
sanPuerquitoProgramador / Romina.php
Last active June 13, 2018 23:35
Library for CI; The common taks for development
<?php defined('BASEPATH') OR exit('No direct script access allowed');
Class Romina{
public function __construct()
{
date_default_timezone_set('America/Mexico_City');
setlocale(LC_TIME, 'es_ES');
$this->load->library('session');
$this->load->library('user_agent');
$this->load->database();
@sanPuerquitoProgramador
sanPuerquitoProgramador / BaseModel.php
Last active February 11, 2018 02:32
Base Model for CodeIgniter. It's assumes your tables has crated_at and updated_at fields. The Insert and Update functions fill and updated those fields automatically
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Base_model extends CI_Model{
/**
* { function_description }
*/
function __construct()
{
parent::__construct();
}
@sanPuerquitoProgramador
sanPuerquitoProgramador / hiddenfiles
Last active January 12, 2018 17:22
Script para mostrar y ocultar los archivos ocultos de la mac. Muy util cuando trabajas con .htaccess y otros archivos
display dialog "Archivos ocultos" buttons {"Mostrar", "Ocultar"}
set result to button returned of result
if result is equal to "Mostrar" then
do shell script "defaults write com.apple.finder AppleShowAllFiles -boolean true"
else
do shell script "defaults delete com.apple.finder AppleShowAllFiles"
end if
do shell script "killall Finder"
@sanPuerquitoProgramador
sanPuerquitoProgramador / .htaccess
Created June 12, 2017 19:16
htaccess for CodeIngniter projects
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@sanPuerquitoProgramador
sanPuerquitoProgramador / Update remote repo
Last active January 26, 2017 03:18 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push --set-upstream origin master
$ git remote rm bitbucket
/* simple snippet for create Code Igniter base_url() and site_url() in JavaSCript */
<script type="text/javascript">
var js_site_url = function( urlText ){var urlTmp = "<?php echo site_url('" + urlText + "'); ?>";return urlTmp;}
var js_base_url = function( urlText ){var urlTmp = "<?php echo base_url('" + urlText + "'); ?>";return urlTmp;}
</script>
/* e.g. use in js in the same way use in PHP Code Igniter*/
<script>
js_site_url('main/ajaxcall');
</script>