Skip to content

Instantly share code, notes, and snippets.

View jonnymaceachern's full-sized avatar

Jonny jonnymaceachern

  • Developer @ Media Mechanics
  • Halifax, NS
  • 01:47 (UTC -03:00)
View GitHub Profile
@garvs
garvs / ure-edit-posts-access-id-list.php
Created January 7, 2017 03:58
ure_edit_posts_access_id_list filter
add_filter('ure_edit_posts_access_id_list', 'ure_edit_posts_access_set_id_list');
function ure_edit_posts_access_set_id_list($list) {
$list .= ',1584';
return $list;
}
@obiPlabon
obiPlabon / vc-parent-child-communication.js
Last active December 12, 2019 11:07
Parent to child and child to parent (bidirectional) communication in Visual Composer shortcode
/**
NOTES:
========================
0. Extend container view from "VcColumnView" so that you get a clean UI.
1. Render method called after element is added (cloned), and on first initalization.
2. Use model.getParam(param_name) to get specific param from params.
3. Use model.get("params") to get complete params object.
4. If params is changed then shortcode will be rendered automatically.
5. You do not need to override method that you are not going change, in our file "render".
**/
@mdjwel
mdjwel / vc_custom_icon_font.php
Last active May 5, 2018 07:30
Visual composer custom icon font integration. Here I integrated the thimify icon package.
<?php
add_action( 'vc_before_init', function() {
if (class_exists('WPBMap')) {
add_filter('init', function () {
$param = WPBMap::getParam('vc_icon', 'type');
$param['value'][__('Thimify Icon', 'total')] = 'themify_icon';
vc_update_shortcode_param('vc_icon', $param);
}, 40);
@jonnymaceachern
jonnymaceachern / git-stats-importer.sh
Created October 3, 2016 14:04
git-stats-importer.sh
for D in ./*; do
if [ -d "$D" ]; then
cd "$D"
git-stats-importer -e maceachern.jonny@gmail.com
cd ..
fi
done
@davidgljay
davidgljay / ComponentIndex.js
Last active June 12, 2022 19:22
Pattern for dynamically loading React components based on a config json object.
import config from '../config'
let components = {}
//For each component in the config fiel into an object
for (var i = config.length - 1; i >= 0; i--) {
components[config[i].name] = require(config[i].path).default
}
export default components
anonymous
anonymous / index.html
Created May 27, 2016 16:19
JS Bin // source https://jsbin.com/legeyo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
</head>
<body>
@r-k-b
r-k-b / extract-rfc822-link-from-gmail.user.js
Last active June 27, 2022 17:04
Get an email's RFC822 msgId Link from GMail
@jonnymaceachern
jonnymaceachern / index.php
Last active July 17, 2017 16:50
Get YouTube ID by URL
<?php
function get_youtube_id( $url ) {
preg_match( "#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches );
return $matches[0];
}
// Test
echo get_youtube_id( "https://youtu.be/MZj1bQtRNdk" ) );
@subfuzion
subfuzion / curl.md
Last active April 8, 2024 08:06
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@pavelthq
pavelthq / custom_view.js
Last active March 27, 2024 14:51
Visual Composer: Custom markup element example
(function($) {
window.VcCustomElementView = vc.shortcode_view.extend( {
elementTemplate: false,
$wrapper: false,
changeShortcodeParams: function ( model ) {
var params;
window.VcCustomElementView.__super__.changeShortcodeParams.call( this, model );
params = _.extend( {}, model.get( 'params' ) );
if ( ! this.elementTemplate ) {