Instantly share code, notes, and snippets.

Denis Žoljom dingo-d

View GitHub Profile
View wordpress-delete-all.php
<?php
/**
* !!WARNING!!
* This script will delete everything you have in wordpress.
* I use it only when developing something that requires me to delete everything, e.g. importer.
* You can comment some parts out if you need to quickly delete just posts, or pages or so, but still be very careful!!!
*
* @author Denis Žoljom (https://github.com/dingo-d)
* @license Free to use at your own risk
View keybindings.json
[
{
"key": "cmd+shift+[Period]",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "error_log( print_r( , true ) );"
}
},
{
"key": "cmd+shift+m",
View gitconfig
[user]
email = // email
name = // name
username = // username
signingkey = // your sign in key
[help]
autocorrect = 0
[diff]
tool = default-difftool
[difftool "default-difftool"]
View class-pointers.php
<?php
/**
* Pointers manger file
*
* @since 1.0.0
* @package Plugin
*/
namespace Plugin;
View pointers.js
/* global pointerLocalization */
export default class Pointers {
constructor() {
this.pointersList = {};
this.openedPointers = JSON.parse(localStorage.getItem('openedPointers')) || [];
this.openPointer = this.openPointer.bind(this);
this.setLabel = this.setLabel.bind(this);
this.initPointers = this.initPointers.bind(this);
}
View pointer-init.js
/* global pointerLocalization */
import Pointers from './pointers';
$(function() {
const pointers = new Pointers();
// Filter the current context pointers
const pointersInContext = Object.values(pointerLocalization.pointers)
.filter((pointer) => pointer.context === pointerLocalization.currentScreen);
View .zshrc
# If you come from bash you might have to change your $PATH.
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
View ruby-commands.md

Unutar rubyja

Konzola binding.pry Exit: exit-program Next: Ctrl+D

View travis-local.txt
docker run --name travis-debug -dit travisci/ci-garnet:packer-1512502276-986baf0 /sbin/init
docker exec -it travis-debug bash -l
su - travis
rvm install 2.3.0
rvm use 2.3.0
cd builds
git clone --branch issue_9709_fix https://github.com/ekivolowitz/travis-build.git
cd travis-build
gem install travis
travis # to create ~/.travis
View prevent-duplicates.php
<?php
//in media.php class
/**
* Checks if the file with the same name exists in the media library, and renames it if it does
*
* @param array $file An array of data for a single file.
* @return array $file Modified array of data for a single file if the file name is the same.
*/
public function intercept_file_upload( $file ) {
// If, for some odd reason, the file name is empty don't bother with it and let WP handle it.