Skip to content

Instantly share code, notes, and snippets.

View Hujjat's full-sized avatar
🎯
Focusing

Hujjat Nazari Hujjat

🎯
Focusing
View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@sloped
sloped / paging.php
Created March 19, 2012 16:21
Bootstrap Paging and Wordpress
<?php
//Use this function to create pagingation links that are styleable with Twitter Bootstrap
function paging() {
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
@chrisjhoughton
chrisjhoughton / remove.liquid
Last active September 9, 2023 07:56
Remove a Shopify cart attribute
{% if cart.attributes.yourCartAttribute %}
<script>
$.ajax({
type: 'POST',
url: '/cart/update.js',
data: 'attributes[yourCartAttribute]=',
dataType: 'json'
});
</script>
{% endif %}
@JeffreyWay
JeffreyWay / Modal.vue
Last active January 17, 2022 00:20
JavaScript-specific solution for the mobile Safari viewport height bug/quirk.
<template>
<Teleport to="body">
<div v-show="open"
class="fixed z-10 inset-0 overflow-y-hidden h-full"
role="dialog"
aria-modal="true"
>
<div class="flex items-center justify-center min-h-full text-center">
<!-- Overlay -->
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"
@dev-xo
dev-xo / stripe-payment.tsx
Last active June 29, 2024 15:26
Stripe Checkout - One time payments.
import type { DataFunctionArgs } from '@remix-run/node'
import { json, redirect } from '@remix-run/node'
import { Form } from '@remix-run/react'
import Stripe from 'stripe'
export async function loader({ request }: DataFunctionArgs) {
// Gets params from URL.
const url = new URL(request.url)
const userId = url.searchParams.get('userId')
const successPayment = url.searchParams.get('success')