Skip to content

Instantly share code, notes, and snippets.

View neverything's full-sized avatar
🍀
Good vibes for you

Silvan Hagen neverything

🍀
Good vibes for you
View GitHub Profile
@stenuto
stenuto / convert.sh
Created May 29, 2024 03:45
Convert video file into HLS playlist with multiple resolutions and bitrates
#!/bin/bash
# This script takes a video file as input and converts it into an HLS (HTTP Live Streaming) playlist with multiple resolutions and bitrates. It also generates a thumbnail image from the video.
# Check if an input filename is provided
if [ -z "$1" ]; then
echo "Usage: $0 input_filename (without extension) [-t]"
exit 1
fi

It's time to swap out these placeholders on the new Livewire landing page. Show some love!

(Please reply with a brief testimonial, name, and twitter handle)

image

@mikield
mikield / Web3PubKeyAuthProvider
Created September 2, 2022 14:33
A Laravel Auth Provider to create a Web3 Public key auth system.
<?php
namespace App\Providers\Web3PubKey;
use App\Models\User;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\UserProvider;
use SodiumException;
use Tighten\SolanaPhpSdk\Exceptions\InputValidationException;
use Tighten\SolanaPhpSdk\Util\Buffer;
curl http://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ",
{
"encoding": "jsonParsed",
"filters": [ ]
}
@unaibamir
unaibamir / ld-wp-editor-field.php
Created September 4, 2020 23:20
ld-wp-editor-field.php
add_filter( "learndash_settings_fields", "custom_learndash_settings_fields", 99, 2 );
function custom_learndash_settings_fields( $fields, $metabox_key ) {
if( $metabox_key = "learndash-course-display-content-settings" ) {
$fields['course_materials_2'] = array(
'label' => 'Testing',
'name' => 'course_materials_2',
'type' => 'wpeditor',
'value' => $fields['course_materials_2'],
'default' => '',
'placeholder' => esc_html__( 'Add a list of needed documents or URLs. This field supports HTML.', 'learndash' ),
@lelandf
lelandf / leland_learndash_video_progression_mark_complete_undisabler.php
Created April 11, 2020 19:04
Undisable Mark Complete button if Video Progression setting is disabling it
/* No warranty/support offered */
/* Please test on staging/development site to ensure it meets your needs before applying to production */
function leland_learndash_video_progression_mark_complete_undisabler() {
if ( is_singular( 'sfwd-lessons' ) || is_singular( 'sfwd-topic' ) ) {
?>
<script>
jQuery( document ).ready( function( $ ) {
$(document).on( 'learndash_video_disable_assets', function( event, status ) {
@adeel-raza
adeel-raza / functions.php
Last active August 16, 2021 01:00
Add lesson/topic ID as a link title to lessons/topics names inside LearnDash course table
<?php
add_action( 'learndash-lesson-row-title-before', 'custom_add_title_to_course_lesson_table', 10, 3);
function custom_add_title_to_course_lesson_table( $lesson_id, $course_id, $user_id ) {
if( ! current_user_can('group_leader') && ! current_user_can('administrator') ) {
return;
}
wp_add_inline_script( 'learndash-front',
'if( jQuery("#ld-expand-'.esc_html( $lesson_id ).'").length != 0 ) {
jQuery("#ld-expand-'.esc_html( $lesson_id ).'").find(".ld-item-name").attr("title", '.esc_attr( $lesson_id ).')
<?php
// UPDATE: I wouldn't use this anymore
// UPDATE: I would use this instead: https://developers.learndash.com/constant/learndash_default_course_price_type/
function leland_learndash_set_default_course_access_setting( $options_fields ) {
global $pagenow;
if ( "post-new.php" === $pagenow && "sfwd-courses" === get_post_type() ) {
@adeel-raza
adeel-raza / functions.php
Last active August 16, 2021 01:06
Get LearnDash next lesson link or first lesson link if course not started
function ld_next_lesson_link() {
global $post;
$course_id = learndash_get_course_id( $post );
$user = _wp_get_current_user();
if( $course_id && isset( $user->ID ) ) {
$lessons = learndash_get_lesson_list( $course_id );
if( $lessons ) {
$first_lesson = reset($lessons);
@lucanos
lucanos / lucanos_learndash_classes.php
Created May 22, 2019 03:37
Adds Classes to Learndash Lessons and Topics based on whether the User has Completed Them or Not
function lucanos_learndash_classes( $classes ) {
global $post;
if( in_array( $post->post_type , array( 'sfwd-lessons' , 'sfwd-topic' ) ) ){
$classes[] = 'learndash';
$progress = learndash_get_course_progress( null, $post->ID );
$classes[] = 'learndash-progress-'.( $progress['this']->completed != 1 ? 'in' : '' ).'complete';
}
return $classes;
}