Skip to content

Instantly share code, notes, and snippets.

@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@ebachter
ebachter / iframe_handling_in_react.js
Last active October 6, 2019 10:58
iframe handling in react
import React from 'react';
import { connect } from 'react-redux';
class PageWidget extends React.Component {
componentDidMount() {
this.ifr.onload = () => {
this.ifr.contentWindow.postMessage('hello', '*');
};
window.addEventListener("message", this.handleFrameTasks);
}
@tpae
tpae / Trie.js
Created November 20, 2016 23:49
Trie.js - super simple JavaScript implementation
// Trie.js - super simple JS implementation
// https://en.wikipedia.org/wiki/Trie
// -----------------------------------------
// we start with the TrieNode
function TrieNode(key) {
// the "key" value will be the character in sequence
this.key = key;
@rothschild86
rothschild86 / cf-hubspot.php
Created May 12, 2016 01:46
Caldera Forms to HubSpot CRM integration
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//required plugins: code snippets, caldera forms, caldera forms run action
add_action('consult_req_submitted', 'consult_req_submitted_sync_hubspot');
function consult_req_submitted_sync_hubspot( $data ){
$hubspot_api_key = 'ffffffff-27a0-4591-9b68-27d4bb31ed76';
$hubspot_list_id = '1'; //optional
@rothschild86
rothschild86 / cf-mailpoet.php
Last active March 14, 2017 10:38
Caldera Forms to MailPoet integration
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//required plugins: code snippets, caldera forms, caldera forms run action, MailPoet
add_action('consult_req_submitted', 'consult_req_submitted_sync');
function consult_req_submitted_sync( $data ){
$caldera_name = $data[ 'your_name' ]; //this is the caldera field slug
$caldera_email = $data[ 'email' ]; //this is the caldera field slug
@rothschild86
rothschild86 / cf-mymail.php
Last active May 12, 2016 18:15
Caldera Forms to MyMail integration
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//required plugins: code snippets, caldera forms, caldera forms run action, mymail
add_action('consult_req_submitted', 'consult_req_submitted_sync_mymail'); //as defined in caldera forms run action
function consult_req_submitted_sync_mymail( $data ){
$caldera_name = $data[ 'your_name' ]; //this is the caldera field slug
$caldera_email = $data[ 'email' ]; //this is the caldera field slug
@andyshinn
andyshinn / composer.json
Last active February 18, 2024 12:05
Docker Compose PHP Composer Example
{
"require": {
"mfacenet/hello-world": "v1.*"
}
}
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
<?php
/**
* Make an internal REST request
*
* @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server).
* @param $request_or_method WP_REST_Request|string A WP_REST_Request object or a request method
* @param $path (optional) if the path is not specific in the rest request, specify it here
* @param $data (optional) option data for the request.
* @return WP_Error|mixed
this.$el.find( '.taxonomy-terms' ).select2({
multiple: true,
ajax: {
url: WP_API_Settings.root + 'wp/v2/terms/' + this.options.taxonomy.slug,
data: function( term, page ) {
return {
search: term,
page: page,
_envelope: true
}