Skip to content

Instantly share code, notes, and snippets.

View adriandmitroca's full-sized avatar

Adrian Dmitroca adriandmitroca

View GitHub Profile
@adriandmitroca
adriandmitroca / functions.php
Last active May 12, 2017 18:32
WooCommerce - Hide shipping methods for specific shipping classes / Add support to hide shipping methods for specified shipping classes to WooCommerce
<?php
add_filter('woocommerce_package_rates', 'hide_shipping_methods', 10, 2);
/**
* Hide specific shipping methods for packages with negative cost set.
* There is no need to hard code any IDs of shipping classes or products if you can just set negative value
* on the back-end and then delete these methods on the fly.
*
* @param $rates
@adriandmitroca
adriandmitroca / knapsack.py
Last active April 2, 2017 10:19
Comparison of 3 alghoritms for Knapsack problem
#!/usr/bin/python
# -*- coding: utf-8 -*-
from itertools import combinations
import random
import time
import timeit
"""
Porównaj różne algorytmy rozwiązujące dyskretny problem plecakowy.
@adriandmitroca
adriandmitroca / .htaccess
Created September 8, 2016 11:28
Basic Laravel's htaccess configuration
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
AddHandler application/x-httpd-php70 .php
@adriandmitroca
adriandmitroca / example.com
Created May 16, 2016 12:37
nginx example configuration with OPCache's workaround
server {
listen 80;
listen 443 ssl http2;
server_name example.com www.example.com;
root /home/deploy/example.com/current/public;
error_log /home/deploy/example.com/logs/error.log;
access_log /home/deploy/example.com/logs/access.log;