Skip to content

Instantly share code, notes, and snippets.

@antongorodezkiy
antongorodezkiy / backtrace.php
Created January 30, 2014 12:09
debug_backtrace() with files and lines only
<?php
function backtrace() {
$keys = array('file','line');
$target = array();
foreach(debug_backtrace() as $key => $s) {
/*if ($key == 0) {
continue;
}*/
@antongorodezkiy
antongorodezkiy / FreightRatesAndService.php
Last active November 27, 2018 16:02
UPS Freight API dummy class
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class FreightRatesAndService {
protected $username = '';
protected $password = '';
protected $accessKey = '';
protected $sandbox = '';
protected $endpointUrl = '';
protected static $endpointUrls = array(
@antongorodezkiy
antongorodezkiy / vue-popper.js
Created February 3, 2017 04:12
vue-popper.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var Popper = require('popper.js');
module.exports = {
props: {
showPopper: {
type: Boolean,
@antongorodezkiy
antongorodezkiy / vue-star-rating.vue
Created December 27, 2016 12:36
vue-star-rating.vue
<script>
module.exports = {
props: {
value: {
type: Number,
twoWay: true
},
disabled: {
type: Boolean,
default: false
@antongorodezkiy
antongorodezkiy / google-search-domains.json
Last active November 11, 2016 01:45
Google Search domains with countries JSON ( https://www.google.com/supported_domains )
[
{
"name": "Afghanistan",
"host": "www.google.com.af",
"code": "AF"
},
{
"name": "Albania",
"host": "www.google.al",
"code": "AL"
[
{
"code": "af",
"name": "Afrikaans"
},
{
"code": "am",
"name": "Amharic"
},
{
@antongorodezkiy
antongorodezkiy / vue-popper-directive.js
Last active September 23, 2016 13:10
vue-popper directive
const Popper = require('popper.js');
(function (Vue) {
let VuePopperDirective = {
params: ['placement', 'content', 'show'],
popper: null,
initPopper() {
this.popper = new Popper(
@antongorodezkiy
antongorodezkiy / UPS Freight API Response with TimeInTransit.xml
Last active December 19, 2015 15:08
UPS Freight API Response with TimeInTransit
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<freightRate:FreightRateResponse xmlns:freightRate="http://www.ups.com/XMLSchema/XOLTWS/FreightRate/v1.0">
<common:Response xmlns:common="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<common:ResponseStatus>
<common:Code>1</common:Code>
<common:Description>Success</common:Description>
</common:ResponseStatus>
<?php
class File_Upload
{
/**
* Index key from upload form
* @var string
*/
public $index_key = '';
/**
<?php
// No, Thanks. Direct file access forbidden.
! defined( 'ABSPATH' ) AND exit;
// INIT
add_action( 'after_setup_theme', array( 'unavailable_post_status', 'init' ) );
class unavailable_post_status extends wp_custom_post_status
{
/**