Skip to content

Instantly share code, notes, and snippets.

View GoodRequestGR's full-sized avatar

GoodRequestGR

View GitHub Profile
// Before
.target {
transform: translateX(50%) rotate(30deg) scale(1.2);
}
// Now you can use individual properties:
.target {
translate: 50% 0;
rotate: 30deg;
scale: 1.2;
@GoodRequestGR
GoodRequestGR / Media queries
Created September 2, 2022 10:06
FE Briefly 9
// Before:
@media (min-width: 400px) and (max-width: 600px) {
/* Styles for viewports between 400px and 600px. */
}
// Now you can use:
@media (400px <= width <= 600px) {
/* Styles for viewports between 400px and 600px. */
}
@GoodRequestGR
GoodRequestGR / Výber rodičov pomocou turnaja
Created August 30, 2022 08:07
Algoritmy umelej inteligencie 4 - Genetické algoritmy
val individual1 = turnaj()
val individual2 = turnaj()
val child = krizenie(individual1, individual2)
mutacia(child)
@GoodRequestGR
GoodRequestGR / Uloženie najlepších jedincov z predchádzajúcej populácie
Created August 30, 2022 08:06
Algoritmy umelej inteligencie 4 - Genetické algoritmy
val najlepsi_jedinci = (0 until pocet_najlepsich).map { populacia[it] }
@GoodRequestGR
GoodRequestGR / Vytvoríme si náhodnú populáciu (1)
Created August 30, 2022 08:01
Algoritmy umelej inteligencie 4 - Genetické algoritmy
var populacia = (0 until populationSize).map { nahodnyChromozom() }
fun nahodnyChromozom() = (0 until chromosomeSize).map { nahodnyGen() }
@GoodRequestGR
GoodRequestGR / Adding a Drag Gesture.swift
Last active July 19, 2022 09:29
How to Make a Slide to Unlock Button in SwiftUI
struct DraggingComponent: View {
let maxWidth: CGFloat
private let minWidth = CGFloat(50)
@State private var width = CGFloat(50)
var body: some View {
RoundedRectangle(cornerRadius: 16)
.fill(Color.blueDark)
@GoodRequestGR
GoodRequestGR / Embracing Asynchrony.swift
Last active July 19, 2022 10:59
How to Make a Slide to Unlock Button in SwiftUI
struct UnlockButton: View {
@State private var isLocked = true
@State private var isLoading = false
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
BackgroundComponent()
DraggingComponent(isLocked: $isLocked, isLoading: isLoading, maxWidth: geometry.size.width)
@GoodRequestGR
GoodRequestGR / Adding a Drag Gesture.swift
Last active July 19, 2022 09:00
How to Make a Slide to Unlock Button in SwiftUI
struct DraggingComponent: View {
let maxWidth: CGFloat
private let minWidth = CGFloat(50)
@State private var width = CGFloat(50)
var body: some View {
RoundedRectangle(cornerRadius: 16)
.fill(Color.blueDark)
fun accept(actual: Solution, neighbor: Solution, temp: Double) : Boolean {
val diff = neighbor.cost - actual.cost
if (diff < 0) { return true }
return random.nextDouble() < exp(-diff / temp)
}
@GoodRequestGR
GoodRequestGR / acceptance function and saving.kt
Created July 14, 2022 14:37
Solution to the 8 Queens problem 5
if (accept(riesenie, susedne_riesenie, teplota)) {
riesenie = susedne_riesenie
}