Skip to content

Instantly share code, notes, and snippets.

jQuery.ajax({
url: '/wp-admin/admin-ajax.php',
type: 'POST',
data: {
action: 'update_portfolio_data'
},
success: function(response) {
console.log('Success:', response);
},
error: function(xhr, status, error) {
@ivandoric
ivandoric / add-movies.jsx
Last active December 19, 2022 11:22
Frontend code for adding data to Directus using Flows - video tutorial can be found here: https://www.youtube.com/watch?v=Nrg7BFOWwuc
// Check the video for more info: https://www.youtube.com/watch?v=Nrg7BFOWwuc
import React, {useEffect, useState} from 'react';
import Papa from "papaparse";
const AddMovies = () => {
const [moviesList, setMoviesList] = useState([])
const handleSubmit = (e) => {
@ivandoric
ivandoric / [id].jsx
Last active February 28, 2023 12:42
Code used in video - [Next + Strapi - Internationalization](https://www.youtube.com/watch?v=iqi3ZSp1cpE)
import Link from "next/link";
import { useRouter } from "next/router";
function Page({ content }) {
const router = useRouter();
console.log(router);
return (
<div className="container">
@ivandoric
ivandoric / all.tsx
Created May 30, 2021 09:28
Infinite Scroll And Filters With React Query
import Container from "components/ui/Container"
import VideoCard from "components/VideoCard"
import fetchData from "helpers/fetchData"
import { useEffect, useState, Fragment, useRef } from "react"
import { useInfiniteQuery } from "react-query"
import useIntersectionObserver from "../hooks/useIntersectionObserver"
import Select from "react-select"
import { useUIDSeed } from "react-uid"
import { useRouter } from "next/router"
import Seo from "components/Seo"
@ivandoric
ivandoric / index.php
Last active May 23, 2023 19:23
WordPress Rest API Add Posts From Frontend (Video Tutorials Notes) - Check out the video: https://www.youtube.com/watch?v=_w4Ok-lI48g
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo get_template_directory_uri() ?>/style.css">
<title>Watch Learn Theme</title>
</head>
<body>
<h1>Hello World</h1>
@ivandoric
ivandoric / wl-api.php
Created October 5, 2020 09:17
WordPress Rest API Custom Filters (Video Tutorials Notes) - Check out the video: https://www.youtube.com/watch?v=5rSfAkLO5eo
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
@ivandoric
ivandoric / javascriptreact.json
Created September 13, 2020 08:35
Snippet for bootstraping react component, as seen in this video: https://www.youtube.com/watch?v=WSOwvyNArOA
{
"Bootstrap Component": {
"prefix": "comp",
"body": [
"import { Box } from 'reflexbox'",
"import styled from '@emotion/styled'",
"",
"function $1() {",
" return (",
" <$1Styled>",
@ivandoric
ivandoric / .htaccess
Last active June 27, 2022 09:51
.htaccess file for video tutorial about deploying Node apps to shared hosting. Checkout the video: https://www.youtube.com/watch?v=ebWJbbUT4TA
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:8080/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:1337/$1 [P,L]
@ivandoric
ivandoric / routes.php
Last active March 1, 2020 10:00
Creating reservation and sending mail example through the routes with JWT in OctoberCMS
Route::middleware(['api', 'jwt.auth'])->group(function () {
Route::post('create-reservation', function(Request $request) {
$reservation = new Reservation;
$reservation->pickup = $request->pickup;
$reservation->dropoff = $request->dropoff;
$reservation->user_id = $request->user_id;
$reservation->vehicle_id = $request->vehicle_id;
$reservation->save();
$user = \RainLab\User\Models\User::where('id', '=', $request->user_id)->first();
@ivandoric
ivandoric / gulpfile.js
Last active September 18, 2022 18:14
Adding Svelte To Your Website Using Gulp and Webpack
// This is the code used in video "How To Add Svelte To Your Site?"
// Check out the video here: https://www.youtube.com/watch?v=ZL7mKFQHSAY
const gulp = require('gulp')
const sass = require('gulp-sass')
const browsersync = require('browser-sync').create()
const webpack = require('webpack')
const webpackStream = require('webpack-stream')