Skip to content

Instantly share code, notes, and snippets.

View monecchi's full-sized avatar

Adriano Monecchi monecchi

View GitHub Profile
@chriswhong
chriswhong / RadiusMode.js
Created March 1, 2018 12:04
RadiusMode, a custom mode for mapbox-gl-draw for drawing a radius
// custom mapbopx-gl-draw mode that modifies draw_line_string
// shows a center point, radius line, and circle polygon while drawing
// forces draw.create on creation of second vertex
import MapboxDraw from 'mapbox-gl-draw';
import numeral from 'numeral';
import lineDistance from 'npm:@turf/line-distance';
const RadiusMode = MapboxDraw.modes.draw_line_string;
@BrainFeeder
BrainFeeder / server.php
Last active March 29, 2018 13:39
Setting up websockets with Ratchet and React in php (TLS/WSS)
<?php
require dirname(__DIR__) . '/vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$pusher = new Pusher; // Create a Pusher class that implements Ratchet\Wamp\WampServerInterface
// The loop
// Binding to 127.0.0.1 means the only client that can connect is itself.
// To accept remotes we should bind to 0.0.0.0

How to install php7.2-fpm with EasyEngine (Ubuntu)


Add php7.2 repository

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

Install php7.2-fpm

jQuery(document).ready(function($) {
/**
* Media Uploader
*/
var media_uploader = null;
function open_media_uploader_video(img, field) {
media_uploader = wp.media({
title: 'Select or Upload Media',
button: {
text: 'Use this media'
@amboutwe
amboutwe / yoast_seo_title_change-variable.php
Last active May 23, 2022 17:09
Change existing or add custom title or meta template variables
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Change existing title or meta template variable
* Credit: Moshe Harush
* https://stackoverflow.com/questions/36281915/yoast-seo-how-to-create-custom-variables
* Last Tested: Unknown
*/
// define the wpseo_replacements callback
function filter_wpseo_replacements( $replacements ) {
@katopz
katopz / setup-zeromq.sh
Last active August 10, 2021 21:47 — forked from cdjhlee/zeromq_install.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@jeromecoupe
jeromecoupe / gulpfile.js
Last active January 19, 2024 13:43
responsive image pipeline in Gulp
"use strict";
// ---------------------------------------
// packages
// ---------------------------------------
const del = require("del");
const deleteEmpty = require("delete-empty");
const globby = require("globby");
const gulp = require("gulp");
@lukecav
lukecav / functions.php
Created September 22, 2017 20:45
Remove add to cart notices in WooCommerce
function remove_added_to_cart_notice()
{
$notices = WC()->session->get('wc_notices', array());
foreach( $notices['success'] as $key => &$notice){
if( strpos( $notice, 'has been added' ) !== false){
$added_to_cart_key = $key;
break;
}
}
@Tusko
Tusko / parse.php
Last active December 2, 2017 01:39
Parse CSV by line (acf repeater)
<?php
$file = file_get_contents('/wp-content/themes/themename/analyzers.csv');
$lines = explode(PHP_EOL, $file);
$array = array();
foreach ($lines as $line) {
$l = str_getcsv($line);
$array[] = array(
'brand' => $l[1],
'model' => $l[0],
);
@Tusko
Tusko / loadPosts.js
Last active December 2, 2017 01:40 — forked from moskalukigor/functions.php
Wordpress Ajax
//JS
var ajaxcontent = $('.products');
$.ajax({
type: 'POST',
url: window.wp_data.ajax_url,
data: {
action: "loadPosts",
},
success: function (html) {