Skip to content

Instantly share code, notes, and snippets.

@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>
@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 / 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 / make_mysql_backup.sh
Last active August 29, 2015 13:57
Simple mysql backup
#!/bin/bash
# crontab
# 1 1 * * * root /bin/bash /path/to/script/mysql_backup.sh > /var/log/cron.log
### MySQL Server Login Info ###
MUSER="root" # mysql username, change this if needed
MPASS="root_pass" # mysql user password, change this
MHOST="localhost" # mysql host, change this if needed
MYSQL="$(which mysql)"
<?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
{
/**
<?php
class File_Upload
{
/**
* Index key from upload form
* @var string
*/
public $index_key = '';
/**
@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(
[
{
"code": "af",
"name": "Afrikaans"
},
{
"code": "am",
"name": "Amharic"
},
{
@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"
@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