This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in your javascript file ... | |
$(document).ready(function() { | |
$('#send').click(function(){ | |
if($("#email").val().indexOf('@', 0) == -1 || $("#email").val().indexOf('.', 0) == -1) { | |
alert('El correo electrónico introducido no es correcto.'); | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
By yapro | |
File Service: /src/Intranet/OrgunitBundle/Resources/config/services.yml | |
services: | |
form_errors: | |
class: Intranet\OrgunitBundle\Form\FormErrors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in you submit action | |
$userManager = $this->container->get('fos_user.user_manager'); | |
$user->setPlainPassword($password); | |
$userManager->updatePassword($user); | |
..... // perform some action | |
$em->flush(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changing your firewall to match this: | |
security: | |
firewalls: | |
my_firewall: | |
pattern: ^/ | |
form_login: | |
username_parameter: "form_name[username_field_name]" | |
password_parameter: "form_name[password_field_name]" | |
csrf_parameter: "form_name[_token]" | |
csrf_provider: form.csrf_provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Acme/FormsTutorialBundle/AcmeFormsTutorialBundle.php | |
namespace Acme\FormsTutorialBundle; | |
use Symfony\Component\HttpKernel\Bundle\Bundle; | |
class AcmeFormsTutorialBundle extends Bundle | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fechainicial = new DateTime('2012-01-01'); | |
$fechafinal = new DateTime('2013-01-01'); | |
$diferencia = $fechainicial->diff($fechafinal); | |
// El método diff nos devuelve un objeto del tipo DateInterval, | |
// que almacena la información sobre la diferencia de tiempo | |
// entre fechas (años, meses, días, etc.). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Work with data arrays in PHP | |
//A way to pass information around or store information in sessions. | |
//When you work with these, you can't always assume that all properties are defined. | |
//I had some conditional logic code in PHP that was only supposed to execute if an array contained any values: | |
$data = array( | |
'text' => array( 'hello', 'world' ), | |
'numbers' => array( 43, 2, 55 ) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verify and create directories: | |
You’ll need to create directories for the following: backups, colors, swaps and undo. | |
You can download for example your favorite color schema by vimninjas.com and paste in the relevant scheme file ~/.vim/colors/ | |
$cd ~/.vim; | |
$mkdir backups; | |
$mkdir colors; | |
$mkdir swaps; | |
$mkdir undo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.fn.getHiddenDimensions = function(boolOuter) { | |
var $item = this; | |
var props = { position: 'absolute', visibility: 'hidden', display: 'block' }; | |
var dim = { 'w':0, 'h':0 }; | |
var $hiddenParents = $item.parents().andSelf().not(':visible'); | |
var oldProps = []; | |
$hiddenParents.each(function() { | |
var old = {}; |
OlderNewer