Skip to content

Instantly share code, notes, and snippets.

View matthewpoer's full-sized avatar

Matthew Poer matthewpoer

View GitHub Profile
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@eggsurplus
eggsurplus / setFieldRequired
Created August 22, 2012 17:51
Make a field required/not required in edit view of SugarCRM
function setFieldRequired(fieldName, req, msgStr){
if(!msgStr){ msgStr = fieldName; }
for(var i = 0; i < validate["EditView"].length; i++){
if(validate["EditView"][i][nameIndex] == fieldName) {
validate["EditView"][i][msgIndex] = msgStr;
validate["EditView"][i][requiredIndex] = req;
break;
}
}
}
@justincase
justincase / gist:5469009
Created April 26, 2013 17:45
Print struct with field names and values. From http://blog.golang.org/2011/09/laws-of-reflection.html
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
@jmertic
jmertic / gist:5730287
Last active November 14, 2017 13:22
Sample PHP script for connecting to the new RESTful SugarCRM REST API in 6.7 and later.
<?php
// specify the REST web service to interact with
$baseurl = '<<instanceurl>>/rest/v10';
/**
* Authenicate and get back token
*/
$curl = curl_init($baseurl . "/oauth2/token");
curl_setopt($curl, CURLOPT_POST, true);
@chicks
chicks / 1_Install_Tidbit.sh
Last active May 21, 2018 12:46
Load Testing Sugar Cheat Sheet
# Download from here: https://github.com/sugarcrm/Tidbit
# Copy Tidbit to your Sugar Root and unpack
cp Tidbit-master.zip /var/www/html
unzip Tidbit-master.zip
# Run Tidbit
cd Tidbit
php -f install_cli.php -- -c
@chicks
chicks / SugarCRM LAMP Stack Tuning
Last active February 8, 2021 13:33
SugarCRM Performance Tweaks
Apache:
- Activated 'KeepAlive' connections
- Lowered keep alive timeout from 15 seconds to 2 seconds
- Increased the number of minimum workers from 8 to 16
- Activated server status page (/server-status)
APC (Alternative PHP Cache):
- Set cache size to 256MB (ideal for SugarCRM workload)
Memcache:
@amusarra
amusarra / sugarcrm-dev-7-1.conf
Created March 9, 2014 21:33
SugarCRM 7.1 NGINX Config File
server {
listen 8090;
server_name sugarcrmdev-71.dontesta.local;
#charset koi8-r;
access_log /var/log/nginx/sugarcrmdev-71.dontesta.local.access.log main;
error_log /var/log/nginx/sugarcrmdev-71.dontesta.local.error.log;
root /home/sugarcrm/application;
index index.php index.html;
@elchele
elchele / flex-list.hbs
Last active August 29, 2015 14:06
Expanding the default width on the Name column
{{!--
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
* Copyright (C) SugarCRM Inc. All rights reserved.
@aminsol
aminsol / Netsuite Country List PHP Array
Created April 29, 2015 04:47
Netsuite Country List PHP Array
$countries = array(
"AF" => "_afghanistan",
"AX" => "_alandIslands",
"AL" => "_albania",
"DZ" => "_algeria",
"AS" => "_americanSamoa",
"AD" => "_andorra",
"AO" => "_angola",
"AI" => "_anguilla",
"AQ" => "_antarctica",
@groggu
groggu / nsCountryCpdes.php
Created October 12, 2015 20:06
Convert standard ISO country codes to NetSuite's constants
/***
* Convert standard ISO country codes to NetSuite's world
*
* @param $isoCode
*
* @return string|bool
*/
public function convertCountryCode($isoCode)
{