Skip to content

Instantly share code, notes, and snippets.

View sinner's full-sized avatar
:electron:
Crafting

José Gabriel González Pérez sinner

:electron:
Crafting
View GitHub Profile
@sinner
sinner / gist:5202745
Created March 20, 2013 06:32
Alternativa para el UploadHandler de jQueryFile Upload - Entre las lìneas 461 y 469
<?php
...
protected function get_file_name($name, $type, $index, $content_range) {
$name = $this->udate('YmdHisu').$name;
return $this->get_unique_filename(
$this->trim_file_name($name, $type, $index, $content_range),
$type,
$index,
@sinner
sinner / ManageCallBackWithDoneEvent.js
Created March 20, 2013 20:58
Callback jQueryUpload and Setup for Excel Upload
$('#fileupload').on('fileuploaddone', function(e, data) {
//console.debug(data);
$.each(data.result, function (index, file) {
console.debug(file);
var datos = file[0];
$.ajax({
type: "POST",
dataType: "html",
data: datos,
url: "file.php",
@sinner
sinner / ajaxTools.js
Created April 30, 2013 15:57
Funciones útiles para efectuar peticiones ajax y validaciones en campos de texto. Useful functions to make ajax requests and validations in text fields. Requiere de jQuery1.7 o mayor... Require of jQuery1.7 or greater than.
var dialog = [];
dialog['error'] = 'errorDialogBox';
dialog['exito'] = 'successDialogBox';
dialog['alerta'] = 'alertDialogBox';
function displayHtmlInDivId(divResult, dataHtml, conEfecto){
if(conEfecto){
$("#"+divResult).html("").html(dataHtml).fadeIn();
}else{
$("#"+divResult).html("").html(dataHtml);
@sinner
sinner / Connection.php
Last active December 17, 2015 06:18
Insert into While Loop, Data From CSV File
<?php
class Conecction {
protected static $db_name = 'MyDataBase';
protected static $user = 'MyUser';
protected static $passw = '';
@sinner
sinner / bigFourVersion.html
Created May 15, 2013 22:23
Pure CSS Scrollable Table with Fixed Header Using CSS to allow scrolling within a single HTML table
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title>Pure CSS Scrollable Table with Fixed Header</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="language" content="en-us" />
<script type="text/javascript">
<!--
/* http://www.alistapart.com/articles/zebratables/ */
function removeClassName (elem, className) {
elem.className = elem.className.replace(className, "").trim();
@sinner
sinner / .htaccess
Created August 22, 2013 15:35
.htaccess Simple Apache Conf Rewrite Module
<VirtualHost *:80>
ServerName sgc
ServerAlias sgc sgc.dev sgc.com.ve
SetEnv SYMFONY__DATABASE__USER "postgres"
SetEnv SYMFONY__DATABASE__PASSWORD "postgres"
DocumentRoot "/var/www/sgc/web"
DirectoryIndex app.php
<?php
abstract class BaseModelManager {
protected $em;
protected $class;
protected $repository;
protected $container;
/**
* Constructor.
@sinner
sinner / MenuItem.php
Created December 18, 2013 23:45
This is a way to make Selects Nested or Subqueries with DQL on Symfony 2.3. First I show you the entities relateds in the Subqueries facts on the Repository.
<?php
// Acme/DemoBundle/Entity/MenuItem.php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Generated by Symfony2 Console
@sinner
sinner / ComandosSymfony2.sh
Last active June 14, 2017 19:30
Some Symfony 2 Commands
# Este comando funciona para descargar una versión de Symfony2 (2.1.3) y crear un proyecto con el framework. Descarga todos los vendors preconfigurados.
composer create-project symfony/framework-standard-edition myproject/ 2.1.3
# Este comando permite generar un nuevo bundle dentro del proyecto symfony2
php app/console generate:bundle --namespace=Sgi/CommonBundle --format=yml
# Este comando permite que la función assets vincule correctamente los recursos
php app/console assets:install web
# comando que permite limpiar la caché
@sinner
sinner / sgc
Created February 4, 2014 11:17
Configuration Server File with Apache for a Symfony2 Project called sgc
<VirtualHost *:80>
ServerName sgc
ServerAlias sgc sgc.dev sgc.com.ve
SetEnv SYMFONY__DATABASE__USER "postgres"
SetEnv SYMFONY__DATABASE__PASSWORD "postgres"
DocumentRoot "/var/www/sgc/web"
DirectoryIndex app.php