Skip to content

Instantly share code, notes, and snippets.

View spinegar's full-sized avatar

Sean Pinegar spinegar

View GitHub Profile
@yunusga
yunusga / gist:33cf0ba9e311e12df4046722e93d4123
Created April 5, 2017 11:55
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
<?php namespace Sugar\Api;
use Guzzle\Common\Event;
use Guzzle\Http\Client;
use Guzzle\Http\Query;
/**
* SugarCRM 7 REST API Class
*
@KyleGawryluk
KyleGawryluk / gist:7418600
Created November 11, 2013 19:09
SugarCRM - Generating custom error popup from logic hook
Create a custom view to load popup widget js
custom/modules/{module}/views/view.detail.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/json_config.php');
require_once('include/MVC/View/views/view.detail.php');
class po_purchaseOrdersViewDetail extends ViewDetail {
@zbrox
zbrox / iso_array.php
Last active December 22, 2015 14:38 — forked from brianherbert/iso_array.php
ISO 3166-1 alpha-3 countries list as a PHP array sorted by country name, not country code. I've added Scotland (SCO) and England (ENG), because for the purpose I needed it I couldn't go with just Great Britain (GB).
<?php
$iso_array = array (
'AFG' => 'Afghanistan',
'ALB' => 'Albania',
'DZA' => 'Algeria',
'ASM' => 'American Samoa',
'AND' => 'Andorra',
'AGO' => 'Angola',
'AIA' => 'Anguilla',
'ATA' => 'Antarctica',
@jhoffmann
jhoffmann / cache.sh
Created August 23, 2013 16:22
Brute force clear out the SugarCRM cache folder, and repair
#!/usr/bin/env bash
# Symlink as ~/bin/cache for happy fun time excitement.
DO_REPAIR=0
DEFAULT="2"
LEVEL=$DEFAULT
LEVELS[1]="cache/smarty/templates_c"
LEVELS[2]="cache/modules"
LEVELS[3]="cache/jsLanguage cache/themes"
@dlively1
dlively1 / gist:5858513
Last active December 26, 2021 17:36
Sugar 7 Web Services using Guzzle PHP
<?php
require_once 'vendor/autoload.php';
use Guzzle\Http\Client;
$user = '<<user>>';
$password = '<<password>>';
$url = '<<baseurl>>/rest/v10/';
$client = new Client($url);
@kapv89
kapv89 / query-logger.php
Last active January 8, 2019 15:21
Log Queries in L4
<?php
Event::listen('illuminate.query', function($query, $bindings, $time) {
static $count;
if(App::make('env') === 'local')
{
$logFile = __DIR__.'/../storage/logs/queries';
ob_start();
var_dump($bindings, $query);
$str = ob_get_clean();
if($count === null)
@cmourizard
cmourizard / SugarCRM custom form validation with UnderscoreJS.rst
Last active October 27, 2018 14:14
SugarCRM custom form validation with UnderscoreJS

Steps to add custom form validation with UnderscoreJS:

  • Step 1: Include underscoreJS and custom validation in your metadata (current example: custom/modules/Contacts/metadata/editviewdefs.php)
  • Step 2: Use _.wrap function to add your custom validation before of after Sugar original check_form function which validates the form with Sugar rules (current example: custom/modules/Contacts/js/customValidation.js)
  • Step 3: Make a Quick Repair & Rebuild :-)

Additional links:

@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@bickart
bickart / custom_index.php
Last active October 9, 2015 11:58
SugarCRM Extension to added a Custom Index
<?php
/*
* Created on Aug 27, 2012
*
* Jeff Bickart
* @bickart
* NEPO Systems, LLC
*
* custom/Extension/application/Ext/TableDictionary/custom_indexes.php
*/