Skip to content

Instantly share code, notes, and snippets.

View pretzelhands's full-sized avatar

pretzelhands

View GitHub Profile
@pretzelhands
pretzelhands / AcceptanceTester.php
Created November 15, 2018 06:50
A Codeception example for TodoMVC
<?php
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
@pretzelhands
pretzelhands / readNotebagStore.js
Created June 25, 2020 07:41
Allows you to read a notebag.json file
const Conf = require("conf");
const util = require("util");
const store = new Conf({
name: "notebag",
cwd: "ABSOLUTE_PATH_TO_FOLDER_CONTAINING_NOTEBAG_JSON",
encryptionKey: "YOUR_LICENSE_KEY",
});
console.log(
require('dotenv').config();
const { notarize } = require('electron-notarize');
exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}
const appName = context.packager.appInfo.productFilename;
const { notarize } = require('electron-notarize');
async function notarizing(context) {
console.log("• Starting notarization of app");
return await notarize({
appBundleId: 'com.yourorg.whatever',
appPath: "ABSOLUTE_PATH_TO_APP_FILE",
appleId: "YOUR_APPLE_ID_EMAIL",
appleIdPassword: "YOUR_APP_SPECIFIC_APPLE_ID_PASSWORD", // https://support.apple.com/en-us/HT204397
# Return next 60 days by default
start = datetime.combine(date.today(), time(0, 0))
end = start + timedelta(days=60)
logging.error('//////////////////////////////////////// IT IS WHAT IT IS: {} {}'.format(start, end))
if (start := self.request.query_params.get('start')) and (end := self.request.query_params.get('end')):
start = datetime.combine(datetime.strptime(start, '%Y-%m-%d').date(), time(0, 0))
end = datetime.combine(datetime.strptime(end, '%Y-%m-%d').date(), time(23, 59))
logging.error('||||||||||||||||||||||||||||||||||||||||||||| WHATS GOING ON HERE: {} {}'.format(start, end))
@pretzelhands
pretzelhands / readingTimeEstimate.php
Last active January 17, 2021 20:54
Estimate the reading time of your markdown-based articles, as detailed by Medium: https://blog.medium.com/read-time-and-you-bc2048ab620c
<?php
const WPM = 250
const READING_TIME_PER_IMAGE = 12; // seconds
const IMAGE_THRESHOLD = 10; // After this threshold each image counts for 3 seconds
function readingTimeEstimate($markdown) {
$markdown = strip_tags($markdown);
$markdown = str_replace("\n", ' ', $markdown);
@pretzelhands
pretzelhands / cli.php
Last active January 21, 2021 12:47
Distributable PHAR for any app with composer dependencies
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
@pretzelhands
pretzelhands / composer.json
Created January 21, 2021 09:06
A single file CLI app for Composer-based applications
{
"name": "pretzelhands/single-file-cli",
"description": "A single file CLI application",
"type": "cli-app",
"require": {
"symfony/console": "^5.2"
},
"authors": [
{
"name": "Richard Blechinger",
<!-- Search engines -->
<meta name="image" content="https://howmuchdoesthismeetingco.st/assets/social.png">
<meta itemprop="name" content="How much does this meeting cost?">
<meta itemprop="description" content="Keep an overview of how much a meeting costs and whether it's really worth it.">
<meta itemprop="image" content="https://howmuchdoesthismeetingco.st/assets/social.png">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="How much does this meeting cost?">
<meta name="twitter:description" content="Keep an overview of how much a meeting costs and whether it's really worth it.">
@pretzelhands
pretzelhands / index.php
Created June 2, 2021 13:31
Forbidden Prototype Template
<?php
// Your PHP code here
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">