Skip to content

Instantly share code, notes, and snippets.

@maor
maor / 0_reuse_code.js
Created May 17, 2014 13:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
[{
"id": "571",
"type": "0",
"user": "RedAlertAdminApp-95.35.61",
"date": "09\/07\/2014 - 09:01:58",
"message": "Rockets Attack : Moatza Ezorit Eshkol",
"count": 9
}, {
"id": "570",
"type": "0",
<?php
/*
Plugin Name: Just Give Me Berlin.
Plugin URI: http://www.berlin.de/en/
Description: Berlin. Nuff said.
Author: A Berliner
Author URI: http://www.findme.in/berlin
Version: 0.0
*/
@maor
maor / functions.php
Last active June 3, 2016 22:23
A theme helper function for Photon (http://developer.wordpress.com/docs/photon/)
<?php
function ch_photonize( $url = '', $params = array() ) {
$server_pool = rand( 0,3 );
return add_query_arg(
$params,
"https://i{$server_pool}.wp.com/" . str_replace( array( 'http://', 'https://' ), '', $url )
);
}
function maor_image_proportions_classes($attr, $attachment) {
$image = wp_get_attachment_image_src( $attachment->ID, 'full', false );
if ( ! $image )
return $attr;
list( $src, $width, $height ) = $image;
$attr['class'] .= ( $height > $width ) ? ' wp-image-portrait' : ' wp-image-landscape';
@maor
maor / WordPress_Ninja_forms_mailster_integration.php
Last active July 1, 2020 13:01
Quick and dirty method I wrote up to integrate a Ninja Forms into Mailster, make it add subscribers to the main Mailster subscribers list. (WordPress)
<?php
// http://developer.ninjaforms.com/codex/custom-form-action/
// https://kb.mailster.co/mailster-for-developers/
add_action('init', 'ninjaforms_mailster_integration_init');
function ninjaforms_mailster_integration_init() {
if (!function_exists( 'mailster' )) return;
add_action( 'ninja_forms_mailster_integration', 'action_ninja_forms_mailster_integration' );