Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
Coding Stuff

Ionuț Staicu iamntz

🐛
Coding Stuff
View GitHub Profile
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
@iamntz
iamntz / .gitconfig
Created Sep 13, 2013
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.
View .gitconfig
[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)"
View add_number_to_multiselects.py
import sublime
import sublime_plugin
import string
class MultiSelectNumbersCommand( sublime_plugin.TextCommand ):
def run(self, edit):
view = self.view;
window = view.window()
def countThoseSelections(pattern):