Skip to content

Instantly share code, notes, and snippets.

View btribouillet's full-sized avatar

Brieuc Tribouillet btribouillet

View GitHub Profile
import requests
from decouple import config
from ..helpers.vipps_json_generators import get_base_ecom_headers, get_initiate_payment_http_body, \
get_capture_payment_http_body, get_order_ecom_headers, get_order_ecom_cancel_body
base_url = 'https://apitest.vipps.no'
def token_request():
"""
@btribouillet
btribouillet / camera_view.dart
Created February 19, 2021 09:27 — forked from aravindhkumar23/camera_view.dart
Flutter Camera view with + button to open gallery (captured image and gallery picked image will be shown in horizontal scrollable view in bottom like whatsapp)
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path_provider/path_provider.dart';
import '/utils.dart';
@btribouillet
btribouillet / ids_hook.php
Last active June 3, 2020 12:13
example for iconic_wds_get_reservations_query
add_filter( 'iconic_wds_get_reservations_query', array( __CLASS__, 'filter_deliveries_per_warehouse' ) );
/**
* Filter deliveries per warehouse
*
* @param string $q WordPress SQL query statement.
* @return mixed
*/
public static function filter_deliveries_per_warehouse( $q ) {
if ( is_user_logged_in() ) {
@btribouillet
btribouillet / example.php
Created October 15, 2018 14:45
Feature request : apply_filters on delivery date & delivery time
/**
* Update order delivery time with value from location cookie
*
* @param $value
* @return mixed
*/
function update_order_delivery_time( $value ) {
$location = Vmm_Helpers::get_location();
if( isset( $location['timeslot'] ) ) {
@btribouillet
btribouillet / checkout.js
Last active October 15, 2018 12:49
Set timeslot in checkout
// ALTERNATIVE
/**
* Force timeslot in checkout
*/
$('#jckwds-delivery-time').on('change', function() {
if(php_vars.selected_timeslot !== typeof undefined) {
$(this).val(php_vars.selected_timeslot);
}
});
@btribouillet
btribouillet / example.php
Created September 14, 2018 13:33
Feature request (WooCommerce Delivery Slots): Add a filter in slots_available_on_date function
function domain_set_slot_availability( $is_available, $timeslot, $date ) {
// Custom code to set $is_available to false or true.
return $is_available;
}
add_filter( 'iconic_wds_slot_available', 'domain_set_slot_availability', 10, 3 );
@btribouillet
btribouillet / class-reservations.php
Last active September 14, 2018 15:28
Feature request iconic delivery slots: Add an apply_filters in class-reservations.php (line 22 in gist)
/**
* Get reservations.
*
* @param int $processed 1/0
* @param string $operator
* @param string $order
*
* @return array
*/
public static function get_reservations( $processed = 1, $operator = '>=', $order = 'ASC' ) {
@btribouillet
btribouillet / gallery.php
Created June 24, 2017 12:49 — forked from kokers/gallery.php
ACF Pagination Gallery with categories
@btribouillet
btribouillet / imgix.php
Last active June 14, 2017 09:18
get imgix function
wp_get_imgix_image( $attachment_id, $options = '' ) {
$url = '';
$image = wp_get_attachment_image_src( $attachment_id );
$imgix_bucket = get_option( 'imgix_bucket' );
if($image && imgix_bucket) {
$url = $imgix_bucket.$image['url'].$options;
@btribouillet
btribouillet / api.service.ts
Last active May 30, 2017 13:33
OAuthService for oauth2 token
import { Injectable } from '@angular/core';
import { Headers, Http } from '@angular/http';
import { environment } from '../../environments/environment';
import { OAuthService } from './oauth.service';
@Injectable()
export class ApiService {