Skip to content

Instantly share code, notes, and snippets.

View AdrianKuriata's full-sized avatar

Adrian Kuriata AdrianKuriata

View GitHub Profile
@AdrianKuriata
AdrianKuriata / Validation.js
Created November 7, 2018 16:22
Class Validation - Displaying validation fields from laravel backend with AJAX, made with axios and es6, array fields possible too. Added file fix for apple devices on safari browser.
class Validation {
constructor() {
this.forms = document.querySelectorAll('.form-add-edit');
}
init() {
this.forms.forEach(form => {
form.addEventListener('submit', event => {
event.preventDefault();
@AdrianKuriata
AdrianKuriata / font-awesome-list.txt
Created July 25, 2017 07:03
All of font awesome icon classes 4.7
fa-500px
fa-address-book
fa-address-book-o
fa-address-card
fa-address-card-o
fa-adjust
fa-adn
fa-align-center
fa-align-justify
fa-align-left
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@AdrianKuriata
AdrianKuriata / tags.php
Last active November 1, 2016 10:43
This is optimization tags for ManyToMany relationship with Post model for attaching not existing tags.
public function storePost(Request $request)
{
$notexistsTags = array();
$existsTags = Tag::whereIn('id', $request->input('tag_name'))->get();
foreach($request->input('tag_name') as $tag_name) {
// Check if tag currently exist in database
foreach($existsTags as $tag) {
$match = false;
if($tag_name == $tag->id) {