Skip to content

Instantly share code, notes, and snippets.

View homfarnam's full-sized avatar
💻

Farnam Homayounfar homfarnam

💻
View GitHub Profile
@homfarnam
homfarnam / html
Last active September 29, 2018 09:22
VIEWS
def index(request):
template = loader.get_template('index.html')
return HttpResponse(template.render({},request))
=========================
@homfarnam
homfarnam / index2
Last active September 29, 2018 09:23
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Jackson Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
@homfarnam
homfarnam / gist:6542fed4aab9b4b3e3e28b75301cafea
Created June 16, 2020 05:22
show products prices only for users
function wootips_hide_price_add_cart_not_logged_in() {
if ( !is_user_logged_in() ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'woocommerce_single_product_summary', 'wootips_print_login_to_see', 31 );
add_action( 'woocommerce_after_shop_loop_item', 'wootips_print_login_to_see', 11 );
}
@homfarnam
homfarnam / Next Js _document.js
Created March 3, 2021 11:05
Next Js _document.js - styled component
import Document, { Html, Head, Main, NextScript } from "next/document"
import { ServerStyleSheet, createGlobalStyle } from "styled-components"
const GlobalStyle = createGlobalStyle`
body {
padding: 0;
margin: 0;
}
`
class MyDocument extends Document {
static async getInitialProps(ctx) {
@homfarnam
homfarnam / py
Created July 10, 2023 13:19
payment bot
import stripe
stripe.api_key=""
def create_payment():
# This is just an example. You would need to handle payments in a secure environment
session = stripe.checkout.Session.create(
payment_method_types=['card'],