Skip to content

Instantly share code, notes, and snippets.

@solepixel
solepixel / dynamic-pricing-table.php
Last active April 20, 2018 19:11
dynamic pricing table
<?php
function display_dynamic_pricing_table(){
global $post;
# see line 42 of woocommerce_pricing_by_product.class.php
$pricing_rule_sets = get_option('_a_category_pricing_rules', array());
$found = false;
if(count($pricing_rule_sets)){
global $woocommerce_pricing;
foreach ($pricing_rule_sets as $pricing_rule_set) {
//
// SCNVector3+MathUtils.swift
//
// Created by Jeremy Conkin on 4/26/16.
//
import SceneKit
/**
Add two vectors
@steipete
steipete / CombineHelper.swift
Created March 30, 2021 07:55
Combine helper that runs a Future after a delay on a background queue
import Foundation
import Combine
/// Run a block in the background with a delay and make it cancellable.
/// - Parameters:
/// - delay: Delay in milliseconds before the background work starts
/// - queue: Background queue to use
/// - worker: Worker block to execute on queue
/// - completion: Completion handler executed on main thread.
/// - Returns: AnyCancellable token
@vibrazy
vibrazy / Toggle.swift
Created May 10, 2021 10:56
Toggled - Simpler way to deal with hardcoded ViewModifers values in SwiftUI
struct ToggledExampleView_Previews: PreviewProvider {
static var previews: some View {
DebuggingToggledExampleView()
}
}
// MARK: - Toggled Source
protocol ToggleInterface {
associatedtype ValueType
import Foundation
public struct MockFunc<Input, Output> {
public var parameters: [Input] = []
public var result: (Input) -> Output = { _ in fatalError() }
public init() {}
public init(result: @escaping (Input) -> Output) {
self.result = result
@pjechris
pjechris / Appfile
Last active May 24, 2022 17:46
fastlane
# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/docs/Appfile.md
app_identifier ENV["APP_IDENTIFIER"] # The bundle identifier of your app
# You will have to set APP_IDENTIFIER into your .env files
apple_id ENV["APPLE_ID"] # Your Apple email address
team_id ENV["TEAM_ID"] # Developer Portal Team ID
@antonyalkmim
antonyalkmim / HttpService+Rx.swift
Last active November 24, 2022 21:42
A URLSession approach to organize Network layer
import Foundation
import RxSwift
extension HttpService: ReactiveCompatible { }
extension Reactive where Base: HttpServiceType {
func request(_ endpoint: Base.Target) -> Single<Data> {
return Single<Data>.create(subscribe: { [weak base] single in
let task = base?.request(endpoint, responseData: { result in