This file contains 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 | |
// Add buy button on content-product listed in archive-product | |
function k_woocommerce_loop_add_to_cart_link($element, $product) { | |
// With variable products you have to select options | |
// You cannot redirect the user without having the options selected | |
if($product->product_type != 'variable' && $product->is_in_stock()) { | |
$element .= sprintf( '<a href="%s&buy=1" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>', | |
esc_url( $product->add_to_cart_url() ), // it adds 'buy=1' in parameters of URI | |
esc_attr( $product->id ), |
This file contains 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
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
) | |
type ID struct { | |
ID string | |
} |
This file contains 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
const axios = require('axios'); | |
const HttpsProxyAgent = require('https-proxy-agent'); | |
const cheerio = require('cheerio'); | |
const getProxies = async () => { | |
const res = await axios.get('PROXY LIST'); | |
const $ = cheerio.load(res.data); | |
const elements = $( | |
'body > div.wrap > div.services_proxylist.services > div > div.table_block > table > tbody > tr', | |
).toArray(); |
This file contains 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
const puppeteer = require('puppeteer'); | |
const proxy = ''; // '161.35.58.75:8080'; | |
const url = ''; | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
const scrape = async (browser, prefix) => { | |
const page = await browser.newPage(); | |
console.log(`Visiting ${url}`); |
This file contains 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
const json = `{ | |
"type": "two", | |
"value": 25.5, | |
"items": [{ | |
"order": 2, | |
"value": "hello" | |
}, { | |
"order": 5, | |
"value": "bye" | |
}] |
This file contains 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
use std::cell::{Cell, RefCell}; | |
use std::collections::HashMap; | |
use std::fmt::Debug; | |
use std::rc::Rc; | |
#[derive(Debug)] | |
pub struct Error; | |
pub trait Event: Debug { | |
fn code(&self) -> &str; |
This file contains 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
use std::sync::Arc; | |
use async_trait::async_trait; // 0.1.36 | |
#[async_trait] | |
trait Repo { | |
async fn find(&self) -> i32; | |
} | |
struct RepoImpl; |
This file contains 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
pub trait Executor { | |
fn run(&mut self, f: &mut dyn FnMut(i32) -> i32); | |
} | |
struct SimpleExecutor { | |
v: i32, | |
} | |
impl Executor for SimpleExecutor { | |
fn run(&mut self, f: &mut dyn FnMut(i32) -> i32) { |
This file contains 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
use std::rc::Rc; | |
use std::cell::RefCell; | |
// Databases | |
trait DB { | |
fn find(&self) -> String; | |
} | |
struct SQL; |
NewerOlder