Skip to content

Instantly share code, notes, and snippets.

Ionuț Staicu iamntz

Block or report user

Report or block iamntz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iamntz
iamntz / HandlePutFormData.php
Last active Nov 6, 2019 — 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 jawittdesigns/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):
View gist:5070840
<string>(?:^\s+)?(&lt;)((?i:script))\b(?![^&gt;]*/&gt;)</string>
=>
<string>(?:^\s+)?(&lt;)((?i:script))\b(?!([^&gt;]*text/template[^&gt;]*|[^&gt;]*/>))</string>
View gist:4993865
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
<FilesMatch "\.(ttf|otf|eot|svg)$" >
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
You can’t perform that action at this time.