Skip to content

Instantly share code, notes, and snippets.

View blackmann's full-sized avatar
💭
🤟

Degreat blackmann

💭
🤟
View GitHub Profile
@blackmann
blackmann / WrapContentViewPager.java
Created April 23, 2018 15:48 — forked from neilbantoc/WrapContentViewPager.java
A simple view pager that supports wrapping of content by measuring first child and setting that as the viewpager's height.
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
/*
* A simple view pager that supports wrapping of content
* by measuring first child and setting that as the viewpager's height.
*/
public class WrapContentViewPager extends ViewPager{
@blackmann
blackmann / functions.php
Created July 24, 2018 12:25 — forked from lukecav/functions.php
Need Woocommerce to only allow 1 product in the cart. If a product is already in the cart and another 1 is added then it should remove the previous 1
function check_if_cart_has_product( $valid, $product_id, $quantity ) {
if(!empty(WC()->cart->get_cart()) && $valid){
foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
$_product = $values['data'];
if( $product_id == $_product->id ) {
unset(WC()->cart->cart_contents[$cart_item_key]);
}
}
@blackmann
blackmann / gotham.md
Created March 31, 2020 16:13 — forked from mfd/ gotham.md
Gotham font
https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css

<link rel="https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css">