Skip to content

Instantly share code, notes, and snippets.

View pilotmoon's full-sized avatar
🏠
Working from bed

Nick Moore pilotmoon

🏠
Working from bed
View GitHub Profile
@willbchang
willbchang / azure_tts.sh
Last active November 11, 2023 04:55
A simple example to use Azure text to speech REST API with shell script in macOS via Popclip Snippet. You can get the newest version from: https://github.com/willbchang/popclip-azure-text-to-speech
#!/bin/zsh
# #popclip
# name: Azure TTS
# icon: symbol:message.and.waveform
# Please apply for your own key
AZURE_REGION=
AZURE_SUBSCRIPTION_KEY=
# Create a temporary audio file
@pilotmoon
pilotmoon / NetNewsWire.js
Last active February 15, 2023 16:42
PopClip Extension to add a URL to NetNewsWire
// #popclip
// name: NetNewsWire
// icon: iconify:carbon:satellite-radar
// requirements: [url]
// lang: js
const url = popclip.input.data.urls[0];
popclip.openUrl("feed:" + url, {
app: "com.ranchero.NetNewsWire-Evergreen"
});
@nicolas-miari
nicolas-miari / UIBezierPath+Superellipsoid
Created August 29, 2019 01:10
UIBezierPath extension to draw a 'squircle' (superellipsoid) of arbitrary size and "corner radius"
import UIKit
extension UIBezierPath {
/**
Draws the super-elliptic analog of a rounded rect. Unlike the regular rounded rect, the rounded corners
are the quadrants of a superellipse (i.e., parabolic segments), _not_ circular arcs.
If `rect` is a square and `cornerRadius` is equal to half the length or more, and actual superellipse is
drawn (no straight sections along its boundary) just like doing the same with a rounded rect results in a
circle being drawn.
@flavienbwk
flavienbwk / rsatool.py
Last active May 8, 2024 11:37
Generates a private key from the modulus, prime1 and prime2 parameters.
#!/usr/bin/env python2
# Usage : python rsatool.py -n <decimal_modulus> -p <decimal_prime1> -q <decimal_prime2> -e 65537 -v DER -o private.key
import base64, fractions, optparse, random
try:
import gmpy
except ImportError as e:
try:
import gmpy2 as gmpy
@Nikschavan
Nikschavan / woocommerce-remove-uncategorized-from-breadcrumb.php
Last active August 3, 2023 09:14
Remove Untitled category from the breadcrumb.
<?php // don't copy this line in your code.
/**
* Remove uncategorized from the WooCommerce breadcrumb.
*
* @param Array $crumbs Breadcrumb crumbs for WooCommerce breadcrumb.
* @return Array WooCommerce Breadcrumb crumbs with default category removed.
*/
function your_prefix_wc_remove_uncategorized_from_breadcrumb( $crumbs ) {
$category = get_option( 'default_product_cat' );
$caregory_link = get_category_link( $category );
@natecook1000
natecook1000 / NSTimer+Closure.swift
Last active January 6, 2024 07:23
Scheduled NSTimer with a Swift closure
extension NSTimer {
/**
Creates and schedules a one-time `NSTimer` instance.
- Parameters:
- delay: The delay before execution.
- handler: A closure to execute after `delay`.
- Returns: The newly-created `NSTimer` instance.
*/
@cdfmr
cdfmr / NSApplication+SelfRelaunch.m
Created March 26, 2012 11:56
Self relaunch of Cocoa application
@implementation NSApplication (Relaunch)
- (void)relaunchAfterDelay:(float)seconds
{
NSTask *task = [[[NSTask alloc] init] autorelease];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"-c"];
[args addObject:[NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, [[NSBundle mainBundle] bundlePath]]];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:args];
@mikejolley
mikejolley / gist:1800395
Created February 11, 2012 15:01
WooCommerce - Change order notes placeholder
add_filter('woocommerce_checkout_fields', 'custom_woocommerce_checkout_fields');
function custom_woocommerce_checkout_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Your custom placeholder';
return $fields;
}
@madrobby
madrobby / i18n.coffee
Created November 14, 2011 15:45
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
@pilotmoon
pilotmoon / insert_version.sh
Created August 17, 2011 10:30
XCode 4 Git Version Script
# This script fixes up the CFBundleShortVersionString with a string derived from git.
# Place it as a Build Phase just before Copy Bundle Resources
# clone: git submodule add git@gist.github.com:1151287.git gist-1151287
# call: ${SRCROOT}/gist-1151287/insert_version.sh
# PlistBuddy and git executables
buddy='/usr/libexec/PlistBuddy'
git='/usr/bin/git'