Skip to content

Instantly share code, notes, and snippets.

View XedinUnknown's full-sized avatar
💻
WP OOP

Anton Ukhanev XedinUnknown

💻
WP OOP
View GitHub Profile
@XedinUnknown
XedinUnknown / coin-change-problem
Created August 20, 2018 12:56
Coin Change Problem
function count_change ($money, $coins) {
sort($coins, SORT_NUMERIC);
$money = (int) $money;
$ways = array(); // ['denom' => [ 'value' => 'numWays' ]]
foreach ($coins as $_c => $_denom) {
for ($_m = 0; $_m <= $money; $_m++) {
if ($_m === 0) {
$ways[$_c][$_m] = 1;
continue;
@XedinUnknown
XedinUnknown / morse-code-problem.php
Created August 20, 2018 12:54
Morse Code Problem
function possibilities ($word) {
$tree = [
'children' => [
[
'symbol' => 'E',
'children' => [
[
'symbol' => 'I',
'children' => [
[
@XedinUnknown
XedinUnknown / trait-test-template
Created May 25, 2018 15:17
Trait Test - Apache Velocity Template
<?php
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
#if (${TESTED_NAME} && ${NAMESPACE} && !${TESTED_NAMESPACE})
use ${TESTED_NAME};
#elseif (${TESTED_NAME} && ${TESTED_NAMESPACE} && ${NAMESPACE} != ${TESTED_NAMESPACE})
@XedinUnknown
XedinUnknown / .env
Created December 24, 2017 19:01
The environment file for working with Scotch on Rocks
DB_NAME=scotchbox
DB_USER=root
DB_PASSWORD=root
# Optional variables
DB_HOST=localhost
DB_PREFIX=wp_
WP_ENV=development
WP_HOME=http://scotchbox.local
@XedinUnknown
XedinUnknown / switch-to-php-7.0.sh
Last active April 11, 2017 06:27
Converts a Scotchbox to PHP 7.0
#!/bin/bash
# Step 1 - Update Package List
sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/apache2
# Step 2 - Remove PHP 5 and Install PHP 7
sudo apt-get update