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
// Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function) | |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// `wait` milliseconds. | |
const debounce = (func, wait) => { | |
let timeout; | |
return function executedFunction(...args) { | |
const later = () => { |
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
OAuth (Open Authentication) | |
OAuth Client - e.g. My Server | |
OAuth Provider - e.g. Facebook Server | |
1. Register the OAuth Client on the OAuth Provider | |
2. It gets back an Client ID and a Client Secret | |
(On FB you do this manually by creating a developer account) | |
3. We want to authorize a user via the OAuth Provider | |
We send to "GET: provider.com/oauth/authorize?" with |
Note: This is the guide for v 2.x.
For the v3, please follow this url: https://blog.csdn.net/sam_shan/article/details/80585240 Thanks @liy-cn for contributing.
Download: StarUML.io
Source: jorgeancal
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 controller, use the following code | |
// Single file | |
def file = request.getFile("identifier_name_in_html_tag_attribute") | |
// Useful information | |
file.empty | |
file.class // => class org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile | |
file.name // the name attribute value you used above (comes from html input tag) | |
file.originalFilename |
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 mapDiff(Map m1, Map m2, String path="") { m1.each{k,v-> | |
if(m2[k] != m1[k]) { | |
if(m1[k] in Map) { | |
mapDiff(m1[k] as Map, m2[k] as Map, "${path}${k}.") | |
} | |
else { | |
println("${path}${k} ->"); | |
println("\texpected: ${m1[k]}") | |
println("\tactual: ${m2[k]}") | |
if (m1[k] in List) { |
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
// Groovy map-reduce example | |
// declare a closure | |
def half = { it -> | |
it / 2 | |
} | |
// declare another closure | |
def sum = { result, i -> | |
result + i |
How do I dropdown?
This is how you dropdown.
<details> <summary>How do I dropdown?</summary> <br> This is how you dropdown.
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:
Permalink: git.io/vps
Provider | Type | RAM | Cores | Storage | Transfer | Network | Price |
---|
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
static String toCamelCase( String text, boolean capitalized = false ) { | |
text = text.replaceAll( "(_)([A-Za-z0-9])", { Object[] it -> it[2].toUpperCase() } ) | |
return capitalized ? capitalize(text) : text | |
} | |
static String toSnakeCase( String text ) { | |
text.replaceAll( /([A-Z])/, /_$1/ ).toLowerCase().replaceAll( /^_/, '' ) | |
} | |