Skip to content

Instantly share code, notes, and snippets.

@ryanbadger
ryanbadger / Shoprocket.tsx
Created December 26, 2023 12:47
Framer Component - Shoprocket
import { addPropertyControls, ControlType } from "framer"
import * as React from "react"
/**
* @framerSupportedLayoutWidth auto
* @framerSupportedLayoutHeight fixed
*/
export function ShoprocketComponent({ publishableKey }) {
React.useEffect(() => {
@ryanbadger
ryanbadger / ShoprocketEmbed.tsx
Last active December 26, 2023 12:48
framer component (Shoprocket embed)
import * as React from "react"
import { Frame } from "framer"
import { ShoprocketComponent } from "./Shoprocket.tsx"
export function MyFramerComponent() {
return (
<Frame style={containerStyle}>
<ShoprocketComponent publishableKey="sr_live_xxxxxxxxxxx" />
</Frame>
)
@ryanbadger
ryanbadger / sign.php
Last active June 30, 2022 10:24
NGINX - generate signed URLs with php
<?php
function generateUrl($filename) {
$secret = 'your_key'; // add your key here that matches with nginx config
$baseUrl = 'yourdomain.com'; // the hostname of your server - no trailing slash
$path = '/f/s/' . $filename; // path to your file
$ttl = 3600; // 3600 seconds equals 1 hour, change as you require it
return $this->buildSecureLink($baseUrl, $path, $secret, $ttl);
}
<!-- SHOPROCKET SR-BLOCK START -->
<div class="sr-block sr-default" sr-meta="" sr-show-max="99" style="visibility: hidden;">
<div class="sr-item sr-buy-widget sr-small">
<div class="sr-image-holder">
<img src="[IMAGESRC]/convert?w=460&h=460&fit=max&quality=100" class="sr-image" title="[NAME]" alt="[NAME]"/>
</div>
<div class="sr-product-details">
<div class="sr-name">[NAME]</div>
<div class="sr-strapline">[STRAPLINE] </div>
<div class="sr-description">[DESCRIPTION] </div>
<div class="sr-products" data-embed="multiple_products"><script type="application/json">{"store_id":1,"options":{"products_to_display":"all","categories":[],"product_size":"medium","image_dimension":"pre_defined","image_dimension_value":"crop","image_width":"600","image_height":"600"},"includes":{"show_search_box":"on","show_sort_by":"on","show_category_dropdown":"on","show_product_name":"on","show_product_price":"on","show_product_image":"on"},"actions":{"button_behaviour":"add_to_cart","show_select_quantity":"on","hover_behaviour":"view_product_button"},"product_popup":{"show_product_name":"on","show_product_price":"on","show_product_image":"on","show_select_quantity":"on","show_image_thumbnails":"on","thumbnail_layout":"horizontal_below","image_dimension":"pre_defined","image_dimension_value":"crop","image_width":"600","image_height":"600"},"styles":{"product_title":"#666666","product_price":"#666666","button_background":"#f49a22","button_color":"#ffffff","product_background":"#ffffff","show_product_shadow
<div class="sr-block sr-default" sr-meta="" sr-show-max="99" style="visibility: hidden;"> <div class="sr-item sr-buy-widget sr-small"> <div class="sr-image-holder"> <img src="[IMAGESRC]/convert?w=460&h=460&fit=max&quality=100" class="sr-image" title="[NAME]" alt="[NAME]"/> </div><div class="sr-product-details"> <div class="sr-name">[NAME]</div><div class="sr-strapline">[STRAPLINE] </div><div class="sr-price">[CURRENCY][PRICE]</div><a class="sr-add-link" href="[ADDTOCART]" type="button"> <div class="sr-add"><i class="fa fa-shopping-cart"></i> Buy Now</div></a> </div></div></div>
<?php if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) : ?>
<script language="text/javascript">
var ocelot = ocelot || {};
ocelot.readerCountryCode = <?php echo "'" . $_SERVER["HTTP_CF_IPCOUNTRY"] . "'"; ?>;
</script>
<?php endif; ?>
@ryanbadger
ryanbadger / gist:f625eaa0f189ad1ef61496b8ccf56cc7
Last active January 19, 2018 09:06
Upload widget for 120431
<!-- Uploadfiles.io includes for header or footer -->
<script src="https://uploadfiles.io/assets/js/jquery.min.js"></script>
<script src="https://uploadfiles.io/assets/js/widget.js" charset="utf-8"></script>
<link rel="stylesheet" href="https://uploadfiles.io/assets/css/widget.css">
<!-- Upload widget - paste this into your page where you want the upload widget to show -->
<form class="dropzone" id="uf-dropzone">
<input type="hidden" name="user_id" value="1">
<input type="hidden" name="auth_key" value="CD3AD1D493156CD4E979BA9386C41">
@ryanbadger
ryanbadger / gist:155d33e24ffe3602d304f64ba7dc51a9
Last active December 14, 2017 18:06
Upload widget for 120261
<!-- Uploadfiles.io includes for header or footer -->
<script src="https://uploadfiles.io/assets/js/widget.js" charset="utf-8"></script>
<link rel="stylesheet" href="https://uploadfiles.io/assets/css/widget.css">
<!-- Upload widget - paste this into your page where you want the upload widget to show -->
<form class="dropzone" id="uf-dropzone">
<!-- Optional upload message
<div class="dz-message needsclick">
Your upload message here