Skip to content

Instantly share code, notes, and snippets.

View r1q's full-sized avatar
🏠
Working from home

Riq Abuirshaid r1q

🏠
Working from home
View GitHub Profile
@r1q
r1q / DateTimePicker.ts
Created October 17, 2024 03:35 — forked from fmdz387/DateTimePicker.ts
DateTimePicker with Shadcn/Radix UI
'use client';
import * as React from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
import {
addMinutes,
format,
isEqual,
setHours,
@r1q
r1q / wordpress-6-2-2-docker-compose.yml
Created February 29, 2024 22:15 — forked from erikyuzwa/wordpress-6-2-2-docker-compose.yml
Wordpress 6.2.2 Docker Compose for Local Development
# create a local .env file with the following 4 properties:
#
# MYSQL_DATABASE=<something>
# MYSQL_USER=<something>
# MYSQL_PASSWORD=<something>
# MYSQL_ROOT_PASSWORD=<something>
#
version: "3.8"
services:
@r1q
r1q / .zshrc
Created April 23, 2023 18:41 — forked from callumlocke/.zshrc
ZSH function to auto-switch to correct Node version
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
@r1q
r1q / RatingStars.js
Last active June 14, 2022 04:48
React Rating Stars Component
// Usage: <RatingStars init={0} />
import React, { useState } from "react";
// Icons used for the rating-icon
import fullStarImg from "./assets/stars/full.png";
import halfStarImg from "./assets/stars/half.png";
import emptyStarImg from "./assets/stars/empty.png";
// Helper to calculate the mouse position on the icon
@r1q
r1q / JSONImporterExporter.gs
Created August 9, 2021 20:42 — forked from seanli1/JSONImporterExporter.gs
Import/Export JSON in Google Sheets - original: https://gist.github.com/pamelafox/1878143
// IMPORT
/**
* Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population")
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function IMPORTJSON(url,xpath){
@r1q
r1q / aws-lambda-redirect.js
Created February 11, 2019 22:23 — forked from DavidWells/aws-lambda-redirect.js
How to do a 301 redirect from an AWS lambda function
exports.handler = (event, context, callback) => {
const response = {
statusCode: 301,
headers: {
Location: 'https://google.com',
}
};
return callback(null, response);
}
@r1q
r1q / send-text-netlify.js
Created November 26, 2018 02:48 — forked from DavidWells/send-text-netlify.js
How to send a text via twilio with netlify functions
import TwilioSdk from 'twilio'
// Your Account SID from www.twilio.com/console
const accountSid = process.env.TWILIO_ACCOUNT_SID
// Your Auth Token from www.twilio.com/console
const authToken = process.env.TWILIO_AUTH_TOKEN
// instantiate twilio SDK
const twilio = new TwilioSdk(accountSid, authToken)
// use twilio SDK to send text message https://www.twilio.com/docs/libraries/node
exports.handler = (event, context, callback) => {