This file contains hidden or 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
public class NestedCategories | |
{ | |
public static void main(String[] args) { | |
new NestedCategories(); | |
} | |
NestedCategories() { | |
List<Category> fullCategoryList = new ArrayList<>(); | |
fullCategoryList.add(new Category(1, 0)); |
This file contains hidden or 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
// ******* JAVA PROJECT "1": ******* | |
import javax.ws.rs.ApplicationPath; | |
import javax.ws.rs.core.Application; | |
@ApplicationPath("/api/v1") | |
public class ApplicationConfiguration extends Application { } |
This file contains hidden or 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 | |
//print_r($_SERVER['REQUEST_METHOD']); | |
switch($_SERVER['REQUEST_METHOD']) { | |
case 'GET': | |
echo 'GET'; // do anything | |
break; | |
case 'POST': | |
echo 'POST'; // do anything | |
break; | |
case 'PUT': |
This file contains hidden or 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
FROM java:openjdk-8-jdk | |
ADD target/demo-swarm.jar /opt/demo-swarm.jar | |
EXPOSE 8081 | |
ENTRYPOINT ["java", "-jar", "/opt/demo-swarm.jar"] |
This file contains hidden or 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 app; | |
import javax.websocket.OnClose; | |
import javax.websocket.OnMessage; | |
import javax.websocket.OnOpen; | |
import javax.websocket.Session; | |
import javax.websocket.server.ServerEndpoint; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.Set; |
This file contains hidden or 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
<h1>php htmlspecialchars()</h1> | |
<h3>without END_QUOTES flag is an xss attack possible:</h3> | |
<?php | |
echo "<a href='" . htmlspecialchars("'onmouseover='a()'") . "'>link</a><br/>"; | |
echo "<textarea style='overflow: none; width: 350px; border: none; resize: none; line-break: none;'>"; | |
echo "<a href=''onmouseover='a()''>link</a>"; | |
echo "</textarea><br/>"; | |
echo "<a href='" . htmlspecialchars("'onmouseover='alert(123)'") . "'>link</a><br/>"; | |
echo "<textarea style='overflow: none; width: 350px; border: none; resize: none; line-break: none;'>"; |
This file contains hidden or 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 | |
function getRandomPassword($passwordLength = 4) { | |
$alphabet = 'abcdefghijklmnopqrstuvwxyz'; | |
$characterCollection = array_merge(str_split($alphabet), str_split(strtoupper($alphabet)), str_split('1234567890'), str_split('!~@#-_+<>[]{}')); | |
$randomPassword = ''; | |
for($i = 0; $i < $passwordLength; $i++) { | |
$randomPassword .= $characterCollection[array_rand($characterCollection)]; | |
} |
This file contains hidden or 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
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class RegexExampleNumberOfHits { | |
public static void main(String[] args) { | |
String txt = "dfsd weqwe asdasdw und \nsch\nqschwexs xsdad\nschaber\n\reewwww dxddasdfsf\n\rsch\n\r dfsgfgd bieeewwwww"; | |
// word content | |
Matcher matchSentence = Pattern.compile("sch", Pattern.CASE_INSENSITIVE).matcher(txt); | |
int hits = 0; |
This file contains hidden or 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> | |
<head> | |
<title>fancybox</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css"> |
This file contains hidden or 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 | |
$email = '[email protected]'; // when email-domain-part contains umlauts, use the idn format: idn_to_ascii('your-email@example-äöü.com'); | |
$emailLength = mb_strlen($email); | |
$randomFactor = ''; | |
$encodedMail = ''; | |
for ($ix = 0; $ix < $emailLength; $ix++) { | |
$randomFactor .= rand(1, 9); | |
} |