Skip to content

Instantly share code, notes, and snippets.

View 1stevengrant's full-sized avatar
🏠
Working from home

Steven Grant 1stevengrant

🏠
Working from home
View GitHub Profile
@1stevengrant
1stevengrant / ExportCSV.php
Created October 25, 2023 13:56 — forked from MrPunyapal/ExportCSV.php
PHP Function to Export Products as CSV (without saving it in server)
<?php
function exportCSV()
{
// Define response headers for CSV download
$headers = [
"Content-type" => "text/csv",
// Specifies the content type as CSV
"Content-Disposition" => "attachment; filename=products.csv",
// Instructs the browser to treat it as a downloadable attachment with the filename 'products.csv'
<div className="bg-accent pb-32">
<nav className="bg-accent fixed top-0 left-0 right-0">
<div className="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div className="border-b border-gray-700">
<div className="flex items-center justify-between h-16 sm:px-0">
<DesktopNav isOpen={isOpen} setOpen={setOpen} />
{/* <img className="h-15 w-15" src={logo} /> */}
<p className="text-base text-2xl pr-3 text-white font-bold antialiased">
{data.site.siteMetadata.title}
</p>
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
@1stevengrant
1stevengrant / statamic.sh
Last active January 22, 2020 16:04
I was helping a friend get a Statamic instance running locally today.
#!/bin/bash
set -euo pipefail
echo "About to install the things Statamic needs to run locally..."
echo -n "Do you want to clear previous settings? (y/n)"
read answer
if echo "$answer" | grep -iq "^y"; then
echo "Clearing out previous settings..."
$data = [
"postcode" => "g728tu",
"key" => "ce2d2-f28bb-eab99-0364f",
"response" => "data_formatted",
];
$response = Zttp::get('http://pcls1.craftyclicks.co.uk/json/rapidaddress', $data);
return $response->json();
<template>
<form @submit.prevent="oneOff">
<label for="cardholder-name">Cardholder Name</label>
<input id="cardholder-name"
v-model="name"
class="block border mb-4 p-4 border-gray-500 w-full"
type="text">
<label for="amount">Amount</label>
<input type="number"
id="amount"
@1stevengrant
1stevengrant / DonationController.php
Created June 18, 2019 10:31
Laravel controller that accepts a custom donation amount via Stripe API
<?php
namespace App\Http\Controllers;
use App\Donation;
use App\Http\Requests\DonationRequest;
use App\Notifications\DonationReceived;
use App\Notifications\DonationThanks;
use App\User;
use Stripe\Charge;
.form-label {
@apply .mb-2 .block .text-sm .text-dark;
}
.form-input,
.form-textarea,
.form-select {
@apply .p-2 .leading-normal .block .w-full .border .text-dark .bg-light .text-sm .font-sans .rounded .text-left .appearance-none;
&:focus {
### Keybase proof
I hereby claim:
* I am 1stevengrant on github.
* I am stevengrant (https://keybase.io/stevengrant) on keybase.
* I have a public key ASCF1aJS7MeIWFwUp9c0HKjZcxw8f7q-otTmqIyb7kNZwAo
To claim this, I am signing this object:
@1stevengrant
1stevengrant / video-tracking.js
Last active February 21, 2019 09:57
Google Analytics: HTML5 Video Tracking
document.addEventListener('DOMContentLoaded', init, false)
var videoId = document.getElementById('video')
//var videoTitle = videoId.getAttribute('data-description')
var videoTitle = '宝宝身边有怪物'
function init () {
videoId.addEventListener('ended', videoEnd, false)
videoId.addEventListener('timeupdate', videoTimeUpdate, false)
videoId.addEventListener('play', videoPlay, false)