Skip to content

Instantly share code, notes, and snippets.

@jevgen
jevgen / perlbrew_libgcc_s.txt
Created Sep 10, 2020 — forked from Dreyer/perlbrew_libgcc_s.txt
[perlbrew] ld: library not found for -lgcc_s.10.4
View perlbrew_libgcc_s.txt
$ cd /usr/local/lib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib
@jevgen
jevgen / force-ssl-url-scheme.php
Created Aug 7, 2019 — forked from webaware/force-ssl-url-scheme.php
For WordPress, force the protocol scheme to be HTTPS when is_ssl() doesn't work, e.g. on a load-balanced server where _SERVER['HTTPS'] and _SERVER['SERVER_PORT'] don't indicate that SSL is being used. NB: may not be needed now, see SSL Insecure Content Fixer and HTTP Detection: https://ssl.webaware.net.au/https-detection/
View force-ssl-url-scheme.php
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/webaware/4688802
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work
Version: 1.0.0
Author: WebAware
Author URI: http://webaware.com.au/
@ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility
@jevgen
jevgen / docker-wordpress.sh
Created Aug 13, 2017 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
View docker-wordpress.sh
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@jevgen
jevgen / wp_mail.md
Created Aug 10, 2017 — forked from johnbillion/wp_mail.md
WordPress Emails
View wp_mail.md

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.

There are a few TODOs left. Please bear with me.

@jevgen
jevgen / gist:f78acc925ba9e1e9212a3a6941db5888
Created Feb 24, 2017
Set custom cookie upon completion of Gravity Form
View gist:f78acc925ba9e1e9212a3a6941db5888
function set_form_1_complete_cookie() {
setcookie( 'form-1-complete', 1, strtotime( '+30 days' ), COOKIEPATH, COOKIE_DOMAIN, false, false );
}
add_action( 'gform_after_submission_1', 'set_form_1_complete_cookie' );
@jevgen
jevgen / float2rat.js
Created Jan 19, 2017 — forked from anonymous/float2rat.js
JavaScript function to convert a floating point number into a ratio with the help of some continued fractions.
View float2rat.js
function float2rat(x) {
tolerance = 1.e-4;
h1=1; h2=0;
k1=0; k2=1;
b = x;
do {
a = Math.floor(b);
aux = h1; h1 = a*h1+h2; h2 = aux;
aux = k1; k1 = a*k1+k2; k2 = aux;
b = 1/(b-a);
@jevgen
jevgen / Gravity Forms Reset Styles
Created Nov 16, 2016 — forked from forgeandsmith/Gravity Forms Reset Styles
Gravity Forms SCSS reset styles for easy style editing and management
View Gravity Forms Reset Styles
///////////////////////////////////////////////
////// GRAVITY FORMS RESET STYLES //////
///////////////////////////////////////////////
// These styles are made in mind to be used with SCSS or LESS
// If you use these styles, you must go to the Gravity Forms settings in the WordPress back end and set Output CSS to No.
////----- Core Containers
.gform_heading,
.gform_body,
@jevgen
jevgen / inline-validation.js
Created Nov 16, 2016 — forked from guyroutledge/inline-validation.js
Inline form validation with Gravity Forms
View inline-validation.js
// if an invalid form field has been made valid,
// remove the shouty error highlighting - if a valid
// required field has been made invalid, start shouting
$('input, textarea, select').on('change', function(){
var $input = $(this);
var isRequired = $input.parents('.gfield').is('.gfield_contains_required');
var isValid = $input.is(':valid');
if ( isRequired && isValid ) {
@jevgen
jevgen / latency.markdown
Created Oct 9, 2016 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
@jevgen
jevgen / gist:c9968b1c1f97763e829ab490514a83ad
Created Oct 8, 2016 — forked from clifgriffin/gist:8827396
Change comment notification recipient for Shopp products
View gist:c9968b1c1f97763e829ab490514a83ad
<?php
add_filter('comment_notification_recipients', 'override_comment_notice_repicient', 10, 2);
function override_comment_notice_repicient($emails, $comment_id) {
$comment = get_comment( $comment_id );
if ( empty( $comment ) )
return $emails;
$post = get_post( $comment->comment_post_ID );
You can’t perform that action at this time.