Skip to content

Instantly share code, notes, and snippets.

View iamntz's full-sized avatar
🐛
Coding Stuff

Ionuț Staicu iamntz

🐛
Coding Stuff
View GitHub Profile
@iamntz
iamntz / update-bedrock.sh
Created January 1, 2024 07:57
quickly update bedrock-related files
#!/bin/bash
## Description: Update bedrock packages
## Usage: update-bedrock [wp|plugins|themes]
## Example: "ddev update-bedrock" or "ddev update-bedrock wp" or "ddev update-bedrock plugins" or "ddev update-bedrock themes"
## ExecRaw: true
## HostWorkingDir: true
case $1 in
wp)
@iamntz
iamntz / readme.md
Last active May 17, 2022 16:15
WP CLI wrapper to run commands on all sites in a network

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:

@iamntz
iamntz / README.md
Last active March 24, 2020 17:56
Șterge spamul de la 2performant
  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 October 16, 2024 08:06 — 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.
<?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.
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);
<?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 October 3, 2018 11:07 — forked from JAW-Dev/repeatable.php
Repeatable Option Fields
<?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
*
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 18:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@iamntz
iamntz / .gitconfig
Created September 13, 2013 06:40
Usage: add these lines in your `~/.gitconfig` file (in Windows you can press win+r and type %home% to open the right folder). The, in terminal, you could do `git lol` to see a nicely formatted log or `git zip` to quickly zip current branch and so on.
[alias]
lol = log --graph --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %C(black bold)- %an %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
hash = rev-parse --short HEAD
curbranch = "!git branch | grep \"*\" | sed \"s/* //\""
zip = "!HASH=$(git hash) && BRANCH=$(git curbranch) && git archive --format zip --output $BRANCH-$HASH.zip master"
pu = "!git push origin $(git curbranch) --progress" ; TODO: add a parameter to allow stuff like `git pu custom-remote-name`
pp = "!git pull origin $(git curbranch)"