Skip to content

Instantly share code, notes, and snippets.

View flegfleg's full-sized avatar

Florian Egermann flegfleg

View GitHub Profile
@flegfleg
flegfleg / Logseq Hookmark integration script.scpt
Created December 15, 2023 10:34
Logseq Hookmark integration (Copy URL)
-- Logseq Hookmark integration via Applescript
-- Copies Links to Pages only, not blocks.
tell application "System Events"
-- Press "ESC"
key code 53
set the clipboard to ""
delay 0.5
-- You need to set a keyboard shortcut for "Copy page Url" in Logseq
@flegfleg
flegfleg / Logseq+Hookmark.scpt
Last active December 8, 2023 22:40
Logseq Hookmark integration Applescript
-- Logseq Hookmark integration via Applescript
-- Copies Links to pages only, not blocks.
-- Paste this into Hook -> Preferences -> Scripts -> Logseq -> Get Address
tell application "System Events"
set the clipboard to ""
delay 0.5
-- You need to set a keyboard shortcut for "Copy page Url" in Logseq
-- Here: CMD + CTRL + SHIFT + U
@flegfleg
flegfleg / cleanup-userswp-profile.php
Created February 7, 2022 16:04
Remove profile picture, social notifications and privacy menu entries from userswp profile. Prevent users from accessing others' profiles.
// remove Notifications and privacy menu entries
add_filter('uwp_account_available_tabs', 'uwp_account_available_tabs_cb');
function uwp_account_available_tabs_cb($tabs){
unset($tabs['notifications']);
unset($tabs['privacy']);
return $tabs;
}
// prevent users from accessing other users' profiles
add_action('template_redirect', 'template_redirect_cb', 9);
@flegfleg
flegfleg / hook.1s.sh
Created January 19, 2022 16:38
xbar plugin: show hooked documents count
#!/usr/bin/env bash
# <xbar.title>Hook</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Florian Egermann</xbar.author>
# <xbar.author.github>flegfleg</xbar.author.github>
# <xbar.desc>Show the count of hooked documents in the menu bar.</xbar.desc>
count=$(osascript -e'
tell application "Hook"
@flegfleg
flegfleg / Save selected Safari text to Craft.scpt
Created May 28, 2021 09:43
Save Safari selection to new document in Craft.app inbox
tell application "Safari"
set spaceID to "SET YOUR SPACE ID"
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
set docUrl to URL of document 1
set docTitle to name of document 1
set markdownText to "" & selectedText & "" & " - " & docUrl
<?php
/**
* Plugin Name: Change registration url
* Description: You need to edit the plugin file in an editor for it to work!
* Author: Florian Egermann
* Author URI: https://www.fleg.de/
*/
@flegfleg
flegfleg / main-query-and-temp-query.php
Created September 4, 2020 11:09
save WordPress query, alter query, reset query
<div class="grid-layout">
<?php
// main query
global $post;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 0;
$main_query_args = array(
'post_type' => 'post',
'posts_per_page' => 10,
'category' => 1,
@flegfleg
flegfleg / template-frontpage.php
Last active September 3, 2020 21:38
Front page with sub query and pagination
<?php
/**
* Template Name: Front page
*
* Template Post Type: page
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package _s
*/
/**
* Get the top level parent category, even on sub-categories
* @return string
*/
function _s_get_parent_cat() {
$term = get_queried_object();
$children = get_terms( $term->taxonomy, array(
'parent' => $term->term_id,
@flegfleg
flegfleg / Front page dein-lastenrad.de Deutsch.html
Last active June 29, 2020 17:34
Front page dein-lastenrad.de / Deutsch
<!-- Front page dein-lastenrad.de / Deutsch. Mirror: https://gist.github.com/flegfleg/637e0dfc0f3e42f7ab53b77a5ebd873a -->__NOTOC__
{{#css:
hr, .contentHeader, #catlinks { display: none }
h1 { color: #eec241 }
.box img { max-width: 50%; margin-top: 30px; }
.no-padding { padding: 0; }
.hero h1, h2 { border-bottom: 0 }
.hero h2 { color: #FFFFFF }
.hero.blue .col-md-8{ padding: 0; }
.hero.green .col-md-8{ padding: 0; }