Skip to content

Instantly share code, notes, and snippets.

@phpleo
phpleo / gist:5408655
Created April 17, 2013 23:38
Grid de Ext.js dentro de un grid oculto
// http://forums.ext.net/showthread.php?7285-GridPanel-inside-div-having-style-display-none
Try to replace:
style="display:none;"
by:
class="x-hide-offsets"
if (userGrid.getSelectionModel().hasSelection()) {
var row = userGrid.getSelectionModel().getSelection()[0];
console.log(row.get('dni'))
}
@phpleo
phpleo / 1.js
Created December 28, 2011 20:44
Sobreescibir remote: de Jquery.validate
// http://forum.jquery.com/topic/validate-using-remote-webservice-and-json-not-working
$(".fieldUsername").rules("add", {
remote: function(){
var r={
type: "POST",
url: "/wservices/clientscriptservices.asmx/CheckUserNameExist",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: "{'username':'" + $(".fieldUsername").val() + "'}"
@phpleo
phpleo / 1.js
Created December 28, 2011 20:44
Eliminar el .d de un respuesta ajax en ASP.Net
// http://stackoverflow.com/questions/6998990/problem-with-jquery-validate-plugin-remote-validation
remote: function() {
return {
type: "POST",
url: GetBaseWSUrl() + 'MyService.asmx/IsValidCode',
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify({ umltCode: $('#Code').val() }),
dataFilter: function (data) {
var x = (JSON.parse(data)).d;
@phpleo
phpleo / 1.master.aspx
Created November 3, 2011 21:42
Mensajes
<!-- Al inicio de la pagina, tiene los elementos html de los mensajes -->
<%@ Register TagPrefix="ams" TagName="ucMensajes" Src="~/Common/uc/ucMensajes.ascx" %>
<head>
<!-- Previo a esto debe estar jquery y jquery UI -->
<script src="<%=ResolveUrl("~/Scripts/codemaleon/ns.js") %>" type="text/javascript"></script>
<script src="<%=ResolveUrl("~/Scripts/ABT/UI/Mensajes.js") %>" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
@phpleo
phpleo / 1.aspx
Created October 17, 2011 15:51
Validacion de campos con Infragistics (ASP)
<script src="<%=ResolveUrl("~/Scripts/jquery.validate.min.1.9.0.js") %>" type="text/javascript"></script>
<script src="<%=ResolveUrl("~/Scripts/IFG/IFG.DropDown.js") %>" type="text/javascript"></script>
<script src="<%=ResolveUrl("~/Scripts/ABT/Form/ExtraJqueryValidation.js") %>" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
// La función de validar se debe de llamar desde el OnLoad
validarEnviar();
});
@phpleo
phpleo / ubuntu_v11.04.sh
Created October 3, 2011 00:19
Jenkins CI en ubuntu
# Fuente: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
# Referencias:
# - https://gist.github.com/819043
$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
$ sudo aptitude update
$ sudo aptitude install jenkins
$ /etc/init.d/jenkins status
@phpleo
phpleo / 1.sql
Created August 18, 2011 14:03
SQL DateTime and comparison
-- http://demiliani.com/blog/archive/2006/01/19/3384.aspx
WHERE DateDiff(dd, OrderDate, '01/01/2006') = 0
WHERE Convert(varchar(20), OrderDate, 101) = '01/01/2006'
WHERE Year(OrderDate) = 2006 AND Month(OrderDate) = 1 and Day(OrderDate)=1
WHERE OrderDate LIKE '01/01/2006%'
WHERE OrderDate >= '01/01/2006' AND OrderDate < '01/02/2006'
@phpleo
phpleo / texto_valor.aspx
Created August 2, 2011 05:34
Infragistics WebDropDown
// seleccionar texto y valor
// http://localhost:17140/samplesbrowser/Samples/WebDropDown/EditingAndSelection/ClientEvents/Default.aspx?cn=drop-down&sid=4a840952-2e28-4251-91a7-ea31cb23256b
<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" DropDownContainerWidth="200px"
DropDownAnimationDuration="2000" EnableDropDownAsChild="false" LoadingItemsMessageText="Loading items..." AccessKey="j" StyleSetName="IG">
<ClientEvents SelectionChanged="selectedIndexChanged" SelectionChanging="selectedIndexChanging" />
<Items>
<ig:DropDownItem Value="a" Text="A.M.">
</ig:DropDownItem>
<ig:DropDownItem Value="b" Text="Being There">
@phpleo
phpleo / Numeros
Created July 27, 2011 16:21
Regex
// entero
^\d+$
// IntDecimal1To2
^\d+$|^\d+\.\d{1,2}$
// Decimal number with thousands separator / http://RegExr.com?2skir
^(\d+(\,\d{3})*(\.\d{1,2})?)?$