Skip to content

Instantly share code, notes, and snippets.

View dmje's full-sized avatar

Mike Ellis dmje

View GitHub Profile
@ScottKillen
ScottKillen / print.css
Last active June 18, 2024 02:59
PDF export stylesheet for obsidian
/* Obsidian snippet to style output of pdf exports
*/
@media print {
/* set your preferred fonts here.
*/
:root {
--body-font-family: "Newsreader Text", TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
@merlinmann
merlinmann / wisdom.md
Last active April 17, 2024 21:52
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@JamesSimpson
JamesSimpson / perfex_hooks_list
Last active May 4, 2024 14:18
Full Perfex Hook List - For Perfex CRM Developers
File ---> application\controllers\admin\Authentication.php:
23: hooks()->do_action('admin_auth_init');
80: hooks()->do_action('after_staff_login');
107: hooks()->do_action('after_staff_login');
117: hooks()->do_action('after_staff_login');
219: hooks()->do_action('after_user_logout');
File ---> application\controllers\admin\Auto_update.php:
14: hooks()->do_action('before_perform_update', $latest_version);
@ssddanbrown
ssddanbrown / export-books.php
Last active January 2, 2024 10:46
BookStack-Export-Books
#!/usr/bin/env php
<?php
// API Credentials
// You can either provide them as environment variables
// or hard-code them in the empty strings below.
$apiUrl = getenv('BS_URL') ?: ''; // http://bookstack.local/
$clientId = getenv('BS_TOKEN_ID') ?: '';
$clientSecret = getenv('BS_TOKEN_SECRET') ?: '';
@tilayealemu
tilayealemu / largest-image-in-webpage.php
Last active May 25, 2019 20:54
Get largest image in html page using php
<?php
// example call: http://localhost/largest.php?url_without_http=bbc.co.uk
$url = $_GET['url_without_http'];
$largest = get_largest_img("http://" . $url);
$embed = empty($largest) ? "Suitable image not found" : "<img src='" . $largest . "'>";
echo("<html><body>" . $embed . "</body></html>");
function get_largest_img($url) {
@amboutwe
amboutwe / yoast_seo_opengraph_change_image_size.php
Last active June 3, 2024 18:39
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/
@nsaqib-cw
nsaqib-cw / Cloudways API PHP Example.php
Last active November 30, 2023 19:05
Cloudways API PHP Example
<?php
//Use this function to contact CW API
/**
*
* @param string $method GET|POST|PUT|DELETE
* @param string $url relative URL for the call
* @param string $accessToken Access token generated using OAuth Call
* @param type $post Optional post data for the call
* @return object Output from CW API
*/
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@wboykinm
wboykinm / geojson.php
Last active June 14, 2024 20:01
Sample PHP to Point GeoJSON
<?php
/**
* PHP GeoJSON Constructor, adpated from https://github.com/bmcbride/PHP-Database-GeoJSON
*/
# Connect to MySQL database
$conn = new PDO('mysql:host=localhost;dbname=mydatabase','myusername','mypassword');
# However the User's Query will be passed to the DB:
$sql = 'SELECT * from GDA_database WHERE user_query = whatever';
@jakebellacera
jakebellacera / ICS.php
Last active June 2, 2024 02:20
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*