Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
Coding Stuff

Ionuț Staicu iamntz

🐛
Coding Stuff
View GitHub Profile
@iamntz
iamntz / readme.md
Last active May 17, 2022
WP CLI wrapper to run commands on all sites in a network
View readme.md

After you install wp-cli:

If you're on Linux:

  1. Install wpmu wrapper: curl https://gist.githubusercontent.com/iamntz/0018e0535d15e00cf012a18486f102ad/raw/wpms.sh -o /usr/local/bin/wpmu
  2. make it executable: chmod +x /usr/local/bin/wpms
  3. Run commands as you'd normally do, using wpms instead, e.g. wpms plugin list

If you're on Windows:

View gist:10740afa881010ac4d97e374a8ee4718
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--aws-sigv4 <provider1[:provider2[:region[:service]]]> Use AWS V4 signature authentication
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
View gist:1c9d3b47fbba614e0690185b90312f7e
enterEditMode() {
if (!this.editable || this.isLoading || this.isEditing) {
return;
}
this.isLoading = true;
this.loadValues(this.name).then((data) => {
this.isLoading = false;
this.isEditing = true;
@iamntz
iamntz / README.md
Last active Mar 24, 2020
Șterge spamul de la 2performant
View README.md
  1. Deschizi chrome dev tools
  2. Faci orice operațiune ajax în UI 2performant
  3. te duci în tab-ul network
  4. click 2 -> copy -> fetch (atenție, să fie headerele ce includ și adresa de mail)
  5. copiezi tot ce este în header în INSERT_HEADERS_HERE
  6. Posibil să fie nevoie să ajustezi page=1&perpage=100
  7. Paste la tot în consolă.
@iamntz
iamntz / HandlePutFormData.php
Last active Jan 20, 2021 — forked from Stunext/HandlePutFormData.php
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests. Deals with one level of form arrays.
View HandlePutFormData.php
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/Stunext
*
* PHP, and by extension, Laravel does not support multipart/form-data requests when using any request method other than POST.
View acf-post_object-emoji.php
add_filter("acf/fields/post_object/result", function ($title, $post, $field, $post_id) {
if (has_post_thumbnail($post->ID)) {
$title .= ' 🖼'; // picture emoji
}
return $title;
}, 10, 4);
View acf-wpml-media.php
<?php
add_action('wpml_updated_translation_status', function ($data) {
$postid = $data['translation_id'];
$groups = acf_get_field_groups();
foreach ($groups as $group) {
$fields = acf_get_fields($group);
foreach ($fields as $field) {
if ($field['type'] == 'gallery') {
$fieldValues = get_field($field['name'], $postid, false);
@iamntz
iamntz / repeatable.php
Last active Oct 3, 2018 — forked from JAW-Dev/repeatable.php
Repeatable Option Fields
View repeatable.php
<?php
define('OU_PL_OPTIONS', 'OU_PL_OPTIONS');
define('OU_PL_PREFIX', 'OU_PL_PREFIX');
define('OU_PL_TEXTDOMAIN', 'OU_PL_TEXTDOMAIN');
if( !class_exists( 'OU_Settings' ) ) {
class OU_Settings {
/**
* Option
*
View make-vvv.js
var fs = require('fs');
var path = require('path');
var readline = require('readline');
var args = process.argv.slice(2);
var clientName, projectName;
clientName = projectName = args[0];
if( args[1] ){
projectName = args[1];
@iamntz
iamntz / 0_reuse_code.js
Created May 31, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console