Skip to content

Instantly share code, notes, and snippets.

View Yiannistaos's full-sized avatar
🏠
Working from home

Yiannis Christodoulou Yiannistaos

🏠
Working from home
View GitHub Profile
@Yiannistaos
Yiannistaos / upload-wp-users-to-laravel-with-password.md
Last active September 3, 2020 12:06
Migrating WordPress users and passwords to Laravel (tested with Laravel 7.x and WordPress 5.5)

How to Migrating WordPress users and passwords to Laravel

** Tested with Laravel 7.x and WordPress 5.5

STEPS


  1. Download the sql table "wp_users" from WordPress, and upload it to the laravel mysql table.
  2. Create the migration:
@amorkovin
amorkovin / restapi-wp.js
Last active September 8, 2022 10:47
REST API WordPress JavaScript fetch await async
const urlRequest = 'http://wp.loc/wp-json/wp/v2/posts?_fields=title';
async function getPostsFromWp() {
try {
const response = await fetch( urlRequest )
const data = await response.json()
return data
} catch ( e ) {
console.error( e )
}
@primaryobjects
primaryobjects / react-confirm.js
Created November 1, 2017 19:03
A simple example of a confirm alert dialog in ReactJs / React.
<div className='delete-button' onClick={() => { if (window.confirm('Are you sure you wish to delete this item?')) this.onCancel(item) } } />
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
@ethanstenis
ethanstenis / Postman POST PUT Requests.txt
Last active May 13, 2024 13:07
How to make Postman work with POST/PUT requests in Laravel...
To make Postman work with POST/PUT requests...
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header.
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)...
<meta name="csrf-token" content="{{ csrf_token() }}">
** If using jQuery, you can now instruct it to include the token in all request headers.
$.ajaxSetup({
var gulp = require('gulp');
var less = require('gulp-less');
gulp.task('less', function() {
return gulp.src('./style.less') // only compile the entry file
.pipe(less())
.pipe(gulp.dest('./build'))
});
gulp.task('watch', function() {
gulp.watch('./*.less', ['less']); // Watch all the .less files, then run the less task
@BFTrick
BFTrick / woocommerce-settings-tab-demo.php
Last active March 26, 2024 10:48
A plugin demonstrating how to add a WooCommerce settings tab.
<?php
/**
* Plugin Name: WooCommerce Settings Tab Demo
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a
* Description: A plugin demonstrating how to add a WooCommerce settings tab.
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active January 30, 2024 02:30
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@mbabker
mbabker / gist:3211464
Created July 30, 2012 22:53
Creating a category via component postflight
// Get the database object
$db = JFactory::getDbo();
// JTableCategory is autoloaded in J! 3.0, so...
if (version_compare(JVERSION, '3.0', 'lt'))
{
JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
}
// Initialize a new category