This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; The app will show those queries in today's journal page, | |
;; the "NOW" query asks the tasks which need to be finished "now", | |
;; the "NEXT" query asks the future tasks. | |
;; Arturs comment: "A8C" is my work. I tag my work tasks with "A8C" | |
:default-queries | |
{:journals | |
[ | |
{:title "🛠 TODO" | |
:query (and (or (todo TODO) (todo DOING) ) ( not [[LATER]] ) ( not [[FollowUp]] ) ( not [[A8C]] ) ) | |
:collapsed? true} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://piszek.com/2013/03/13/walidacja-numeru-pesel-w-javascript/ | |
// Funkcja dekodujaca nr. Pesel | |
function peselDecode(pesel) { | |
// Wycinamy daty z numeru | |
var rok = parseInt(pesel.substring(0, 2), 10); | |
var miesiac = parseInt(pesel.substring(2, 4), 10) - 1; | |
var dzien = parseInt(pesel.substring(4, 6), 10); | |
// Pesel został wprowadzony w 20 wieku, ale zawiera modyfikatory na przysłość | |
// Miesiąc zawiera dodatkowe liczby dla dat z przyszłości. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("click", function ( e ) { | |
const target = e.target; | |
if ( | |
target.tagName === "BUTTON" && | |
target.innerText === 'WordPress' | |
) { | |
const id = target.closest('.roam-block').id; | |
const blockUid = id.substring(id.length - 9, id.length); | |
const data = window.roamAlphaAPI.q('[ :find (pull ?e [ :block/string :block/heading :block/order :block/children :block/refs :children/view-type {:block/children ...} {:block/refs [*]}]) :in $ ?uid :where [?e :block/uid ?uid]]', blockUid); | |
const text = blockToHTML( data[0][0] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Troamback by @artpi - see: | |
* https://piszek.com/roam/troamback | |
* For installation, put in your [[roam/js]]. Detailed instructions above. | |
* | |
* This script will put a reference in your daily page to a random block with a special tag. | |
* For example, I will get a reference on my daily page to a random block tagged with "Grateful". | |
*/ | |
// These are configurable: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will animate an "Explosion" whenever you complete a TODO in Roam Research. | |
// See https://deliber.at/roam for more Roam goodies. | |
// Put this file under {{[[roam/js]]}} block. I have a page roam/js. Under that, I have {{[[roam/js]]}} and under that the javascript block | |
document.addEventListener("click", function ( e ) { | |
const target = e.target; | |
if ( | |
target.tagName === "INPUT" && | |
target.parentElement.className === "check-container" | |
) { | |
if (target.type === "checkbox" && target.checked ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop this in functions.php or your plugin. | |
// You NEED to have Parsedown.php also : https://github.com/erusev/parsedown | |
wp_embed_register_handler( | |
'github_readme_md', | |
'&https?:\/\/github\.com\/([a-zA-Z-_0-9/]+)\/([a-zA-Z]+)\.md&i', | |
__NAMESPACE__ . '\artpi_github_markdown_handler' | |
); | |
function artpi_github_markdown_handler( $matches, $attr, $url, $rawattr ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put that in functions.php in your theme | |
add_filter( 'the_content', $content, 'private_podcast', 10, 1 ); | |
function private_podcast( $content ) { | |
if( has_category( 'podcast' ) && ! has_access() ) { | |
return "This is a private podcast. Please subscribe here"; | |
} | |
return $content; | |
} | |
function has_access() { | |
global $_GET; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://piszek.com/2020/05/27/evernote-transcriber/ | |
function transcribe_audio_file_in_a_note( $evernoteClient, $note ) { | |
// This will find the place where file is embedded, so we can display the transcription underneath. | |
if( preg_match( '#<en-media hash="([a-z0-9]+)"[^>]+>#is', $note->content, $res ) ) { | |
$id = hex2bin($res[1] ); | |
$resources = array_filter( $note->resources, function( $resource ) use ( $id ) { | |
return $resource->data->bodyHash === $id; | |
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This page should be visible only for 48 hours since the first visit | |
// Drop this in functions.php | |
function make_the_page_visible_only_certain_time_after_first_visit() { | |
$secret_page = PAGE_ID_HERE; | |
$redirect_to_when_expired = URL_TO_REDIRECT; | |
$time_to_visit = 48 * 3600; //48h | |
if ( is_page( $secret_page ) && ! is_user_logged_in() ) { | |
if ( empty( $_GET[ 'visitor_id' ] ) ) { | |
wp_redirect( URL_OF_EXPIRED_PAGE ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/php | |
<?php | |
function get_funcs( $dir ) { | |
if ( is_dir( $dir ) ) { | |
$files = scandir( $dir ); | |
$funcs = array(); | |
foreach ( $files as $file ) { | |
if ( substr( $file, 0, 1 ) !== '.' ) { | |
$funcs = array_merge( $funcs, get_funcs( $dir . "/" . $file ) ); | |
} |
NewerOlder