Skip to content

Instantly share code, notes, and snippets.

View X-Raym's full-sized avatar

Raymond Radet X-Raym

View GitHub Profile
@brandonkramer
brandonkramer / notion.php
Last active November 8, 2024 23:32
(Notion.so) Notion API Integration (PHP) - A simple snippet which tells you, how to add a new page to a Notion database with PHP using Curl and their public API. You need a secret token and the ID of a "Shared" database. In the example below the database needs to have a text property called "Description" and the default "Name" property.
<?php
// Options
$secret_token = 'YOUR_SECRET_TOKEN';
$database_id = 'YOUR_DATABASE_ID';
$notion_version = '2021-08-16';
// Post url
$post_url = 'https://api.notion.com/v1/pages';
@SeanChDavis
SeanChDavis / file.php
Last active July 31, 2024 13:12
EDD - bulk edit variable price options more ALL downloads
<?php // DO NOT COPY THIS LINE
/**
* Bulk edit all downloads with variable price options
*
* This code should only be executed when needed. The purpose is to find
* all downloads with variable pricing, and update their respective variable
* pricing labels (Option Name) based strings given in the custom function.
*
* The easiest way to use the function is with the following WordPress plugins:
@cabrerahector
cabrerahector / wordpress-sort-posts-by-views.md
Last active April 15, 2023 17:57
[WordPress Popular Posts] Adding Views column to the Posts Manage page

Adding Views column to the Posts Manage page

This Gist shows how to add a sortable Views column to the post/page/custom-post-type edit screen.

Out of the box, the script will display the Views column on both the Posts and Pages screens. You can change that by editing the $post_types_with_views_column array at the beginning of the script.

How do I add this to my site?

  1. Using the text editor of your preference, create a file called wpp-sortable-columns.php and add the contents of this script to it.
  2. Place the wpp-sortable-columns.php file in wp-content\plugins.
#define REAPERAPI_NO_LICE
#define REAPERAPI_IMPLEMENT
#include "lice.h"
#include "reaper_plugin_functions.h"
#include <memory>
#include <map>
struct MyDLGTEMPLATE : DLGTEMPLATE
{
@danyell
danyell / htc.php
Last active May 12, 2022 22:17
.htaccess compiler
<?php
/*
* .htaccess compiler
*
* Recurse through all subdirectories, scan .htaccess files, and generate
* directives suitable for inclusion in an Apache configuration file.
* This lets you consolidate all .htaccess directives in the main
* (scanned once) Apache configuration. This has considerable
* performance and security benefits.
*
@hasibomi
hasibomi / changeurl.js
Last active July 20, 2023 22:47
Change URL in Browser Address Bar without reloading using JavaScript and jQuery
/* The solution found here: http://www.aspsnippets.com/Articles/Change-URL-in-Browser-Address-Bar-without-reloading-using-JavaScript-and-jQuery.aspx */
/** HTML5 History pushState method
* The pushState method works similar to window.location but it does not refresh or reload the page and it will modify the URL even if the page does not exists. The pushState method actually inserts an entry into the history of the browsers which allows us to go back and forth using the browser’s forward and back buttons.
* The pushState method accepts the following three parameters.
* 1. State object: - The state object is a JavaScript object which can contain any details about the page and must be serializable.
* 2. Title: - The title of the page.
* 3. URL – The URL of the page.
*/
function HexDump(buf)
local s = {}
s.output = ''
for byte=1, #buf, 16 do
local chunk = buf:sub(byte, byte+15)
s.output = s.output .. string.format('%08X ',byte-1)
chunk:gsub('.', function (c) s.output = s.output .. string.format('%02X ',string.byte(c)) end)
s.output = s.output .. string.rep(' ',3*(16-#chunk))
s.output = s.output .. chunk:gsub('%c','.') .. "\n"
end
@josephernest
josephernest / wavfile.py
Last active November 25, 2024 14:54
wavfile.py (enhanced)
# wavfile.py (Enhanced)
# Date: 20190213_2328 Joseph Ernest
#
# URL: https://gist.github.com/josephernest/3f22c5ed5dabf1815f16efa8fa53d476
# Source: scipy/io/wavfile.py
#
# Added:
# * read: also returns bitrate, cue markers + cue marker labels (sorted), loops, pitch
# See https://web.archive.org/web/20141226210234/http://www.sonicspot.com/guide/wavefiles.html#labl
# * read: 24 bit & 32 bit IEEE files support (inspired from wavio_weckesser.py from Warren Weckesser)
@Tagirijus
Tagirijus / fountain.py
Last active November 12, 2019 14:36
Python3 Fountain parser by Colton J. Provias (fixed by me)
"""
fountain.py
Ported to Python 3 by Colton J. Provias - [email protected]
Based on Fountain by Nima Yousefi & John August
Original code for Objective-C at https://github.com/nyousefi/Fountain
Further Edited by Manuel Senfft
"""
COMMON_TRANSITIONS = {'FADE OUT.', 'CUT TO BLACK.', 'FADE TO BLACK.'}
@maxkostinevich
maxkostinevich / functions.php
Last active February 11, 2023 20:03
WordPress: Export custom data to CSV
<?php
/**
* Export Data to CSV file
* Could be used in WordPress plugin or theme
*/
// A sample link to Download CSV, could be placed somewhere in plugin settings page
?>
<a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a>