Skip to content

Instantly share code, notes, and snippets.

View mauryaratan's full-sized avatar
🦌

Ram Ratan Maurya mauryaratan

🦌
View GitHub Profile
@dkun7944
dkun7944 / CDView.swift
Last active January 14, 2024 23:45
SwiftUI + Swift.Shader CD
//
// CDView.swift
// CD
//
// Created by Daniel Kuntz on 7/3/23.
//
import SwiftUI
struct ShapeWithHole: Shape {
@amosbastian
amosbastian / route.ts
Last active May 1, 2024 14:43
Lemon Squeezy webhook using the new route handler in Next.js 13
import crypto from "crypto";
import { listAllSubscriptions } from "lemonsqueezy.ts";
import { NextRequest } from "next/server";
// Put this in your billing lib and just import the type instead
type LemonsqueezySubscription = Awaited<ReturnType<typeof listAllSubscriptions>>["data"][number];
const isError = (error: unknown): error is Error => {
return error instanceof Error;
};
@Evavic44
Evavic44 / domain.js
Last active November 18, 2023 03:00
A list of popular email domains (TLDs) - 2023
const domains = [
"gmail.com",
"yahoo.com",
"hotmail.com",
"aol.com",
"hotmail.co.uk",
"hotmail.fr",
"msn.com",
"yahoo.fr",
"wanadoo.fr",
@zhuowei
zhuowei / Ensemble.plist
Last active September 18, 2023 06:26
Put this file as /Library/Preferences/FeatureFlags/Domain/Ensemble.plist and reboot to (hopefully) turn on Universal Control on macOS 12
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- not sure which one it is, so set both -->
<key>Ensemble</key>
<dict>
<key>Enabled</key>
<true/>
</dict>
@carlalexander
carlalexander / expect-header-fix.php
Last active August 13, 2021 00:40
WordPress "Expect" header fix
<?php
/**
* By default, cURL sends the "Expect" header all the time which severely impacts
* performance. Instead, we'll send it if the body is larger than 1 mb like
* Guzzle does.
*/
function add_expect_header(array $arguments)
{
$arguments['headers']['expect'] = '';
@heyjones
heyjones / heyjones-userpass.php
Created December 14, 2020 01:24
Enables application password generation through the REST API. Use at your own risk!
<?php
namespace heyjones\userpass;
add_action( 'rest_api_init', __NAMESPACE__ . '\\rest_api_init' );
function rest_api_init() {
register_rest_route(
'heyjones',
@zfarbp
zfarbp / s.md
Last active March 27, 2024 10:34
Trigger Spotify with osascript

Trigger Spotify with osascript

/Applications/Spotify.app/Contents/Resources/Spotify.sdef

# read-only
osascript -e 'tell application "Spotify" to player state'                  # stopped,playing,paused
osascript -e 'tell application "Spotify" to current track'                 # The current playing track.
osascript -e 'tell application "Spotify" to artwork url of current track'  # Image data in TIFF format.
osascript -e 'tell application "Spotify" to artist of current track'       # The artist of the track.
@gmazzap
gmazzap / VersionNumber.php
Created March 24, 2019 19:37
Version number parser and comparator compatible with both Semver and WordPress version numbers.
<?php
/**
* Copyright 2019 Inpsyde GmbH
*
* @license MIT https://opensource.org/licenses/MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@edenthecat
edenthecat / holler.md
Last active February 9, 2018 18:05
Alert me when a process is complete

Install terminal-notifier via homebrew: https://github.com/julienXX/terminal-notifier

If using zsh, create an alias: alias -g holler="echo 'holler' | terminal-notifier -sound default"

Store it in ./zshrc if you're happy with it!

Now you can run bundle exec rspec ; holler and it will make a notification that says "holler" when your tests are done.

@polevaultweb
polevaultweb / ssl.sh
Created January 31, 2018 07:16
Easily create local SSL certificates for development sites that work with you own Certificate Authority https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
#!/bin/sh
if [ "$#" -ne 1 ]
then
echo "Usage: Must supply a domain"
exit 1
fi
DOMAIN=$1