Skip to content

Instantly share code, notes, and snippets.

View drinkmaker's full-sized avatar
🏠
Working from home

Alexander Khmelnitskiy drinkmaker

🏠
Working from home
View GitHub Profile
@neilrackett
neilrackett / php-to-moment.js
Last active December 19, 2024 09:26
Convert PHP date string to Moment.js format
function phpToMoment(str) {
let replacements = {
'd' : 'DD',
'D' : 'ddd',
'j' : 'D',
'l' : 'dddd',
'N' : 'E',
'S' : 'o',
'w' : 'e',
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active May 13, 2025 15:15
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@squarestar
squarestar / install-wp-plugins.php
Last active December 1, 2024 00:09
Programmatically install and activate wordpress plugins
<?php
/**
* Programmatically install and activate wordpress plugins
*
* Usage:
* 1. Edit the $pluginSlugs array at the beginning of this file to include the slugs of all the
* plugins you want to install and activate
* 2. Upload this file to the wordpress root directory (the same directory that contains the
* 'wp-admin' directory).
* 3. Navigate to <your-domain-wordpress-root>/install-wp-plugins.php (If wordpress is installed
@vol4ikman
vol4ikman / gulpfile.js
Last active May 6, 2023 10:46
Install wordpress + theme with gulp.js
// npm install [email protected] gulp-decompress gulp-download vinyl-ftp del gulp-open gulp-run
/****************************
FTP Server connection
****************************/
var ftp_host = 'devurl.net',
ftp_user = 'user',
ftp_pass = 'pass',
//theme_name = 'gulp-starter',
theme_path = './wp-content/themes/';
/* Add Image Stretch Option Control to the Image Gallery Widget */
add_action( 'elementor/element/before_section_end', function( $element, $section_id, $args ) {
/** @var \Elementor\Element_Base $element */
if ( 'image-gallery' === $element->get_name() && 'section_gallery' === $section_id ) {
$element->add_control(
'image_stretch',
[
'label' => __( 'Image Stretch', 'elementor' ),
'type' => \Elementor\Controls_Manager::SELECT,
@fatorx
fatorx / gulpfile.js
Created January 2, 2017 14:59
Gulp execute script PHP
var exec = require('child_process').exec
gulp.task('update-templates', function(){
exec('php scripts/update-html.php', function (err, stdout, stderr) {
console.log(stdout)
console.log(stderr)
})
})
@kameltovic
kameltovic / ajaxupload.html
Last active November 2, 2022 17:18
Upload files through Ajax without jquery
<form action="" enctype="multipart/form-data" id="file-form" method="POST">
<div id="upup">
<h2>Upload update file</h2>
<p id="progressdiv"><progress max="100" value="0" id="progress" style="display: none;"></progress></p>
<input type="file" name="file-select" id="file-select">
<button type="submit" id="upload-button">Upload</button>
</div>
</form>
<script type="text/javascript">
var form = document.getElementById('file-form');
@bjorn2404
bjorn2404 / wp_kses_post_tags.php
Last active July 9, 2024 18:13
WordPress allow iFrames with wp_kses_post filter
<?php
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param array $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
*
* @return array
*/
@dtbaker
dtbaker / code.php
Last active May 21, 2022 10:48
Add a custom control to an existing Elementor widget
// This example will add a custom "select" drop down to the "Image Box"
// This will change the class="" on the rendered image box so we can style the Image Box differently
// based on the selected option from the editor.
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option.
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){
// we are at the end of the "section_image" area of the "image-box"
$section->add_control(
@keeferrourke
keeferrourke / install-google-fonts.sh
Last active May 22, 2023 12:38
A bash script to install all Google Fonts, system wide, on debian based systems (ex. Ubuntu)
#!/bin/sh
# Written by: Keefer Rourke <https://krourke.org>
# Based on AUR package <https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-google-fonts-git>
# dependancies: fonts-cantarell, ttf-ubuntu-font-family, git
sudo apt-get install fonts-cantarell ttf-ubuntu-font-family git
srcdir="/tmp/google-fonts"
pkgdir="/usr/share/fonts/truetype/google-fonts"
giturl="git://github.com/google/fonts.git"