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'
@1stevengrant
1stevengrant / config.php
Created October 28, 2012 17:21
Fixes the daylight savings issue with EE
var $dateTime = new DateTime();
$dateTime->setTimezone(new DateTimeZone('America/New_york'));
$dateTime->setTimestamp(time());
$isDst = (bool)$dateTime->format('I') ? "y" : "n";
$conf['daylight_savings'] = $isDst;
<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;
#!/bin/bash
# File: exp_permissions.sh
# Description: Sets permssions on a ExpressionEngine install
#
# Copyright 2009 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@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)