Skip to content

Instantly share code, notes, and snippets.

View jlcampana's full-sized avatar
:octocat:
emu emu emu...

Jose Luis Campaña jlcampana

:octocat:
emu emu emu...
View GitHub Profile
@jlcampana
jlcampana / ajax.js
Created November 27, 2013 09:17
Popurrí de llamadas AJAX con jQuery
// AJAX CALL FOR DNI
function chequearDNI(dni)
{
hideGrowl();
hideDNI();
$.getJSON('/ajax/dni/check/'+escapeHtml(dni))
.done(function(json)
{
var code = json.code;
if(code==1)
@jlcampana
jlcampana / modificando_form.js
Created November 27, 2013 09:15
Popurrí jQuery y Formularios
$('#boton_submit_etiquetas').click(function()
{
$('#formulario').attr('action', '{{etiquetas_url|e}}');
$('#formulario').attr('method', 'POST');
$('#formulario').submit();
});
$('#boton_submit').click(function()
{
@jlcampana
jlcampana / manipulando_divs.js
Created November 27, 2013 09:13
Elementos + jQuery
$('#boton_eliminar_todas').attr('disabled',false);
$("#activity_indicator").hide();
$('#boton_nuevo_ikea_family').show();
//En formularios, mejor poner readonly en lugar de disabled!
$('#phone1').attr('readOnly',true);
//Comprobar si está chequeado:
if($('#misma_direccion_envio').prop('checked'))
{
}
@jlcampana
jlcampana / centrar_elemento.css
Created November 25, 2013 09:24
Centrar un elemento
body, html {
height: 100%;
}
div#layout { /* exploder 5.5+ */
position: absolute;
left: 0px;
top: 0px;
overflow: hidden;
text-align: center;
@jlcampana
jlcampana / string_replace.js
Created November 25, 2013 09:22
String Replace sin expresiones regulares
/**
*
* Javascript string replace
* http://www.webtoolkit.info/
*
**/
// standart string replace functionality
function str_replace(haystack, needle, replacement) {
var temp = haystack.split(needle);
@jlcampana
jlcampana / chainable external javascript file loading.js
Created November 25, 2013 09:19
Cargar fichero JS después de que haya cargado otro
/**
*
* Chainable external javascript file loading
* http://www.webtoolkit.info/
*
**/
scriptLoader.load([
'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js'
'your-script.js'
@jlcampana
jlcampana / esquinas_redondeadas.css
Created November 25, 2013 09:17
Bordes redondeados
.roundedCorners {
border: 1px solid #000;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.roundedTopCorners {
border: 1px solid #000;
-moz-border-radius-topleft: 10px;
-webkit-border-top-left-radius: 10px;
@jlcampana
jlcampana / objc_modern_enum
Created November 4, 2013 10:58
objc Modern Enum
typedef NS_ENUM(NSUInteger, MyNewType) {
MyNewTypeInstance1,
MyNewTypeInstance2,
MyNewTypeInstance3
};
@jlcampana
jlcampana / selector
Created October 29, 2013 10:04
meter un selector en un nsdictionary
SEL inSelector = @selector(something:);
NSString *selectorAsString = NSStringFromSelector(inSelector);
id dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"some text", @"text", selectorAsString, @"selector", nil];
// Retrieve selector
SEL outSelector = NSSelectorFromString([dict objectForKey:@"selector"]);
#ifdef NSFoundationVersionNumber_iOS_6_1
#define SD_IS_IOS7 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
#else
#define SD_IS_IOS7 NO
#endif