This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Retrieve a single article and its image with requests | |
| import requests | |
| BASE = "https://web-news-service.greenstreet.com" | |
| def get_article(token, article_id): | |
| r = requests.get(f"{BASE}/api/articles/{article_id}", headers={"Authorization": f"Bearer {token}"}) | |
| r.raise_for_status() | |
| return r.json() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Fetch article list with filters using fetch() | |
| async function fetchArticles({ token, region = 'USA', keyword, sectors = [], subregions = [], page = 1 }) { | |
| const url = new URL('https://web-news-service.greenstreet.com/api/articles'); | |
| url.searchParams.set('region', region); | |
| if (keyword) url.searchParams.set('keyword', keyword); | |
| sectors.forEach((s) => url.searchParams.append('sectors', String(s))); | |
| subregions.forEach((r) => url.searchParams.append('subregions', String(r))); | |
| if (page) url.searchParams.set('page', String(page)); | |
| const res = await fetch(url.toString(), { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "message": "The region field must be at least 3 characters.", | |
| "errors": { | |
| "region": ["region is invalid for some reason."] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1) Health check | |
| curl -s https://web-news-service.greenstreet.com/api/ping | |
| # 2) Get regions (requires entitlements) | |
| curl -s -H "Authorization: Bearer $TOKEN" \ | |
| https://web-news-service.greenstreet.com/api/regions | |
| # 3) Get sectors (requires entitlements) | |
| curl -s -H "Authorization: Bearer $TOKEN" \ | |
| https://web-news-service.greenstreet.com/api/sectors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "arguments": { | |
| "filters": [ | |
| "filter_01", "filter_04" | |
| ] | |
| }, | |
| "filters": { | |
| "continents": [ | |
| { | |
| "id": "filter_01", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function zawp_create_coupon_codes() { | |
| if ( isset( $_GET['create_coupons'] ) ) { | |
| $coupons = array( | |
| array( | |
| 'coupon_name' => 'Agnieszka K - OCC - SML client code 100€ OFF', | |
| 'coupon_code' => 'AgnieszkaK100', | |
| 'amount' => '100', | |
| 'type' => 'flat', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($) { | |
| $(document).on('keyup', function(e) { | |
| if ( $('.lightbox').is(':visible') ) { | |
| if ( e.which === 37 ) { | |
| $('.gallery_prev').trigger('click'); | |
| } else if ( e.which === 39 ) { | |
| $('.gallery_next').trigger('click'); | |
| } | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Insert Parameter in URL | |
| * | |
| * Dynamically insert or update a parameter in the URL. | |
| * | |
| * @param {string} key parameter name | |
| * @param {string} value parameter value | |
| * @param {string} base set a custom URL base. | |
| * @param {boolean} historyUpdate defines if it update the URL without reloading the page | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Convert String to ID | |
| * | |
| * @param string $string | |
| * @return string | |
| */ | |
| function zawp_convert_to_id( $string ) { | |
| // Lower case everything |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="side-popup"> | |
| <div class="side-popup__inner aos-init aos-animate" data-aos="fade-left" data-aos-easing="ease-out" data-aos-duration="1000" data-aos-delay="500"> | |
| <h4>Some Heading Goes Here</h4> | |
| <a href="#" class="side-popup__cta button button--primary" target="">CTA Button Text</a> | |
| </div> | |
| </div> |
NewerOlder