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
@RequestMapping("/path/{id}") | |
@ResponseBody | |
public String pathVariable(@PathVariable String id) { | |
return String.format("Wartość zmiennej id = %s", id); | |
} |
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
public void sendHtmlEmail(String to, String subject, String content) { | |
MimeMessage mail = javaMailSender.createMimeMessage(); | |
try { | |
MimeMessageHelper helper = new MimeMessageHelper(mail, true); | |
helper.setTo(to); | |
helper.setFrom("Blog example <from@email.com>"); | |
helper.setSubject(subject); | |
helper.setText(content, true); | |
} catch (MessagingException e) { | |
e.printStackTrace(); |
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 | |
add_action('login_enqueue_scripts', function() { ?> | |
<style type="text/css"> | |
#login h1 a, .login h1 a { | |
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png); | |
width: 185px; | |
height: 185px; | |
background-size: initial; | |
} | |
</style> |
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
public static void localRecord() { | |
String persons = """ | |
Java,Developer,29 | |
Python,Developer,25 | |
John,Doe,65 | |
"""; | |
record LocalPerson(String firstName, String lastName, int age) { | |
LocalPerson(String[] data) { | |
this(data[0], data[1], Integer.parseInt(data[2])); |
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
VarHandle intHandle = MemoryHandles.varHandle(int.class, | |
ByteOrder.nativeOrder()); | |
try (MemorySegment segment = MemorySegment.allocateNative(100)) { | |
MemoryAddress base = segment.baseAddress(); | |
for (int i = 0; i < 25; i++) { | |
intHandle.set(base.addOffset(i * 4), i); | |
} | |
} |
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
from django.contrib.auth.models import User | |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase | |
from selenium.webdriver.firefox.webdriver import WebDriver | |
from selenium.webdriver.support.wait import WebDriverWait | |
class AuthenticationTests(StaticLiveServerTestCase): | |
def __init__(self, methodName='runTest'): | |
super().__init__(methodName='runTest') |
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
@ComponentScan(basePackageClasses = {MainController.class, WebAppConfiguration.class}) |
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
@Column | |
@Type(type = "pl.mloza.hibernate.CustomType") | |
private JsonbObject jsonbObject; |
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 add_arguments(self, parser): | |
parser.add_argument('-d', '--display', | |
action='store_true', | |
default=False, | |
dest='show', | |
help='display text') |
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
from __future__ import unicode_literals | |
import common.functions | |
from django.db import migrations, models | |
def uniquify_keys_for_events(apps, schema_editor): | |
events = apps.get_model("event", "Event").objects.all() | |
for event in events: | |
event.key = common.functions.generate_random_string_32() | |
event.save() |