Skip to content

Instantly share code, notes, and snippets.

View lanks's full-sized avatar

Liam lanks

View GitHub Profile
@lanks
lanks / reviewcap_liquid_template.liquid
Created May 12, 2025 01:37
Reviewcap Liquid template to display product reviews summaries on the product page.
<style >
:root {
--reviewcap-product-text-color: #1D1D1D;
--reviewcap-product-bg-color: #ffffff;
--reviewcap-product-accent-color: #3A21CE;
--reviewcap-product-border-radius: 8px;
--reviewcap-product-border-width: 1px;
--reviewcap-product-border-color: {{ '#1D1D1D' | color_modify: 'alpha', 0.1 }};
--reviewcap-product-footer-color: {{ '#1D1D1D' | color_modify: 'alpha', 0.5 }};
--reviewcap-product-shadow: 0px 0px 4px {{ '#1D1D1D' | color_modify: 'alpha', 0.25 }};
@lanks
lanks / onboard.html.haml
Created January 19, 2023 01:19
Onbaording integrations
.row.mrg-top-45{data: { controller: "modal" } }
.col-md-6.col-xs-12.ml-auto.mr-auto
= render partial: "progress_header", locals: { progress: "48%" }
.card.mrg-top-20
.card-block
%h2.text-center How would you like to start collecting survey responses?
%h5.text-center You can use multiple methods and make changes any time.
#integration_options
= simple_form_for(@product, url: wizard_path, method: "put", data: { controller: "onboard-survey", target: "onboard-survey.form" }) do |f|
.row.mrg-top-20
@lanks
lanks / insight_cards.html.erb
Created July 7, 2020 20:55
Example insight cards using the theme
<div class="row mrg-top-20">
<div class="col-md-3 col-sm-6">
<div class="card">
<div class="card-block">
<h4>All users</h4>
<h4>
<strong>55%</strong>
</h4>
</div>
</div>
@lanks
lanks / picker-controller.js
Created July 7, 2020 20:50
Date range picker stimulus example
import { Controller } from "stimulus"
import moment from 'moment';
export default class extends Controller {
static targets = [ "date_range" ]
connect() {
if(this.date_rangeTarget) {
let selectedRange = false
$(this.date_rangeTarget).daterangepicker({
showCustomRangeLabel: false,
alwaysShowCalendars: true,
@lanks
lanks / example.html.erb
Created July 7, 2020 20:21
Example of setup page with template html
<% content_for(:title, "Details") %>
<div class="card">
<div class="card-block">
<div class="row">
<div class="col-md-6">
<%= simple_form_for(@product, url: product_path(@product.slug), data: { controller: "load", action: "submit->load#displayProcessing" }) do |f| %>
<%= f.input :action, as: :hidden, input_html: { value: "details" } %>
<%= f.input :name, label: "Product name", autofocus: true %>
<%= f.input :website, label: "Product website url" %>
<div class="row">
@lanks
lanks / gist:e175366c4cb88f7e7a7999eb78107df2
Created July 4, 2020 17:06
Read an image to base64 then show it in an image element
static targets = ["image"]
function readImageToBase64(input, callback) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
callback(e.target.result);
};
#!/bin/bash
set -o errexit
IMAGE_MAGICK_VERSION="7.0.8-42"
LIBPNG_VERSION="1.6.37"
PREFIX=/usr/local
WDIR=/tmp/imagemagick
# Install build deps