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
def map = [language:"groovy", framework:"grails"] | |
def keys = map.keySet() as List | |
assert ["language", "framework"] == keys |
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
package com.testing | |
import grails.plugin.springsecurity.annotation.Secured | |
class UserController { | |
def springSecurityService | |
@Secured(['ROLE_ADMIN']) | |
def profile(profileCommand cmd) { | |
if (request.method == "POST") { | |
if (cmd.hasErrors()) { |
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 quartz job | |
package com.testing | |
class SampleJob { | |
def mailService | |
static triggers = { | |
simple repeatInterval: 10000l // execute job once in 100000 seconds, just to try something | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
.measures { display: none; } | |
</style> | |
</head> | |
<body> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style> | |
body { | |
font-family: sans-serif; | |
width: 960px; | |
font-size: 12px; |
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
... | |
if (data) { | |
var opt = $("<option>", { value:data.id, text:data.fullName, selected:true }); | |
$("#client\\.id").append(opt); | |
} | |
... |
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
if (!client.save(flush:true)) { | |
client.errors.allErrors.each { error -> | |
log.error "[$error.field: $error.defaultMessage]" | |
} | |
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
$("#trigger").on("click", function(e) { | |
var count = $('.phonesClient').length; | |
$(".phonesClient:last").clone().insertBefore($(this)).find('input'); | |
if (count > 3){ | |
$(this).off('click') | |
} | |
}) |
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
// Given a set of data where the keys of the objects can vary | |
const data = [ | |
{ name: 'Amanda', email: 'amanda@example.com', genre: 'Female' }, | |
{ name: 'Daniel', email: 'daniel@example.com', genre: 'Male', telephones: ['8989 7667', '8765 4321'] }, | |
{ name: 'Arnulfo', email: 'arnulfo@example.com', genre: 'Male', }, | |
{ name: 'Ricardo', email: 'ricardo@example.com', genre: 'Male', city: 'Leon' }, | |
{ name: 'Mario', genre: 'Male', single: true }, | |
]; |
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
// Having this or similar html | |
<input type="password" name="password" id="password"> | |
<button id="toggleButton">Show password</button | |
// And wanting to display the password when mousedown and hide the password when mouseup or mouseleave | |
// In a similar way as is done in the firefox async login form | |
// If you are in firefox you can go to this url: about:accounts?action=signin&entrypoint=menupanel | |
const password = document.querySelector('#password'); |
OlderNewer