Skip to content

Instantly share code, notes, and snippets.

View eimkasp's full-sized avatar
🍀
Building...

Eimantas eimkasp

🍀
Building...
View GitHub Profile
@eimkasp
eimkasp / functions.php
Created February 8, 2024 11:22
WooCommerce Phone Number Validation (+370/+371/+372) for LT/LV/EE
// Add following code to functions php of your theme
add_action( 'woocommerce_checkout_process', 'validate_phone_number_for_specific_countries' );
function validate_phone_number_for_specific_countries() {
$phone = isset( $_POST['billing_phone'] ) ? wc_clean( $_POST['billing_phone'] ) : '';
$billing_country = isset( $_POST['billing_country'] ) ? wc_clean( $_POST['billing_country'] ) : '';
// Specify the countries requiring phone number validation
$countries_requiring_validation = array( 'LT', 'LV', 'EE' );
@eimkasp
eimkasp / index.pug
Created August 11, 2022 15:26
Simple Weather App Design
.container
.weather-side
.weather-gradient
.date-container
h2(class="date-dayname") Tuesday
span(class="date-day") 15 Jan 2019
i(class="location-icon" data-feather="map-pin")
span(class="location") Paris, FR
.weather-container
i(class="weather-icon" data-feather="sun")
@eimkasp
eimkasp / gist:177bb68258b06c76ec48742cdad30527
Created August 8, 2022 13:43
Javascript Test Užduoties
// 1. Suraskite didžiausią skaičių masyve
// 2. Suskaičiuokite skaičių vidurkį.
var array = [3 , 6, 2, 56, 32, 5, 89, 32];
var largest= 0;
@eimkasp
eimkasp / Section.json
Created March 1, 2022 21:09
Example JSON Component Structure
Sections Array[]
0 [{ // What are our section keys
'component': 'HeroSection', // Define the component that is used for this section
'order' : 1,
'background' : {
'type' : 'image', // video / color
'color' : '#ffffff',
'url' : '#'
},
@eimkasp
eimkasp / setinterval.js
Created November 26, 2021 16:49
setInterval Example
/* Funkcija kuri kartojasi kas sekunde */
let seconds = 0;
setInterval(function() {
console.log("As esu setIntervalFunkcija, sekunde: " + seconds);
seconds++;
}, 1000);
@eimkasp
eimkasp / angular-select.html
Created November 13, 2021 10:15
Angular select + ngModel
<select name="priority" [(ngModel)]="task.priority">
<!-- Perduodame su ngValue string reiksme -->
<option value="high" ngValue="high">High</option>
<!-- Perduodame su [ngValue] string reiksme kaip kintamaji -->
<option value="low" [ngValue]="priority">Low</option>
</select>
@eimkasp
eimkasp / ng.html
Created November 13, 2021 09:33
ngIf ir ngClass
<!-- Rodoma: Jei uzduoties completed kintamasis yra true -->
<!-- ngClass panaudojimo pavyzdiai: https://stackoverflow.com/questions/35269179/angular-conditional-class-with-ngclass -->
<i class="bi-alarm "
[class.text-success]="task.completed"
[ngClass]="{'text-success': task.completed, 'text-danger': !task.completed }"
*ngIf="task.completed"
></i>
<!-- Rodoma: Jei uzduoties completed kintamasis yra false -->
<i class="bi-alarm text-danger" *ngIf="!task.completed"></i>
@eimkasp
eimkasp / ciklai.js
Last active November 13, 2021 10:32
Ciklu uzduorys
1. Parasyti programa kuri konsoleje ispausdintu didziausia skaiciu is pateikto mastyvo:
let data = [1, 20, 5, -1, 0, 10, 25, 33];
+ *Padaryti, kad surastume maziausia skaiciu, kartu su didziausiu skaiciumi
2. Parasyti programa, kuri atspausdintu tik lyginius skaicius:
let data = [5, 10, 20, 30,11, 12, 13, 15];
3. Parasyti programa, kuri suskaiciuoti pateiktu skaiciu vidurki:
let data = [5,1,3,4,5,6,7];
@eimkasp
eimkasp / javascript-oop.js
Created October 29, 2021 16:20
Javascript - Object Oriented Example
// Globalus kintamasis
var objektas = {
info: "informacija"
};
// Funkcijos aprasymo pavyzdys
function test() {
objektas.test = "kazkas";
}