Skip to content

Instantly share code, notes, and snippets.

#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@enlacee
enlacee / query_date.sql
Created May 3, 2014 09:30
MYSQL DATE : filtro por intervalo desde ahora hasta hace 1 dia.
-- Filtro por intervalo desde ahora hasta hace 1 dia
SELECT
slots.slot,
slots.name,
slots.min,
slots.max,
AVG(datos.valor) valor
FROM slots
@enlacee
enlacee / thumbnail.php
Created May 21, 2014 05:45
crear thumbanail PHP tamaño ajustado muy bueno.
<?php
/**
* Funcion probado retorna miniatura con escala requerida.
* @url http://stackoverflow.com/questions/11376315/creating-a-thumbnail-from-an-uploaded-image
*/
function makeThumbnails($updir, $img, $id)
{
$thumbnail_width = 134;
@enlacee
enlacee / chamilo_function.php
Last active August 29, 2015 14:03
funciones en chamilo :)
<?php
function _uniqueFileInDirectory($pathFile)
{
$rs = FALSE;
$pathFile = str_replace('\\', '/', $pathFile); // valid path if is format windows
$ext = pathinfo($pathFile, PATHINFO_EXTENSION);
$file = substr(strrchr($pathFile, "/"), 1);
$fileLessExt = str_replace(".$ext", '', $file);
$path = str_replace($file, '', $pathFile);
@enlacee
enlacee / bg.show-bran-in-git.sh
Last active August 29, 2015 14:03
blog.show-branch
# show git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\033[00m\]\u@\h\[\033[01;33m\] \w \[\033[31m\]\$(parse_git_branch)\[\033[00m\]$\[\033[00m\] "
# Alternative for no show all path in prompt
# only change '\w' to '\W'
@enlacee
enlacee / bg.virtual_host.conf
Created July 18, 2014 18:02
virtual host configurado : valores para setear php memory_limit 200mb
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName chamiloutp.me
DocumentRoot /var/www/chamiloutp/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/chamiloutp/>
Options Indexes FollowSymLinks Multiviews
@enlacee
enlacee / inner-join.sql
Created August 7, 2014 16:41
mysql - query : inner join
/**
* Sql indicator only exist data in c_tool
* if true make join success.
* ------------------------------
* SQL inner join fuera de lo normal
*/
SELECT t.* FROM c_tool t
INNER JOIN (
SELECT c_id, MAX(id) as id
@enlacee
enlacee / windows.linux.php
Created August 11, 2014 18:11
Claen return car (file simple.txt) windows linux
/*
*
\r is carriage return;
\n is line feed.
*
*/
// clean code Even better normalize the text. because you never know what OS visitors uses.
$getdata = str_replace("\r\n", "\n", $getdata);
@enlacee
enlacee / debug_backtrace.php
Last active August 29, 2015 14:05
tracking in php salvavidas, codigo estructurado
<?php
var_dump(debug_backtrace()); ECHO __FILE__; echo "UNSTALL EXTT"; EXIT;
// print error.log
error_log(print_r(debug_backtrace(), TRUE));
@enlacee
enlacee / settingDateTime.js
Created August 16, 2014 21:31
get dateTime of string of date in native javascript
/**
* function setting datetime compatible multiple navigator chrome and firefox
* @param stringDate 2014-07-28 03:42:23
*/
function _settingDateTime(stringDate) {
var myDate = new Date();
//string
var arrayDate = stringDate.split(' ');
if (arrayDate.length > 0) {
var date = arrayDate[0];