Skip to content

Instantly share code, notes, and snippets.

View melvinlee's full-sized avatar

melvinlee melvinlee

  • Singapore
View GitHub Profile
@melvinlee
melvinlee / Bootstrapper.cs
Created May 23, 2014 01:33
Nancy typed factory dependency injection.
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
var factory = new DbConnectionFactory(() => new SQLiteConnection("Data Source=dbname.db3;Version=3"));
container.Register<IDbConnection>(factory.GetConnection());
container.Register<UserRepository>();
@melvinlee
melvinlee / Startup.cs
Created May 23, 2014 01:42
Owin Startup class
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Configure SignalR
app.MapSignalR();
// Configure diagnostics
app.UseErrorPage();
@melvinlee
melvinlee / GitPath.cmd
Created May 26, 2014 10:20
Adding Git to Windows 7/8 Path (System Variables)
Set PATH=%PATH%;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
@melvinlee
melvinlee / elastix-cd.repo
Created May 26, 2014 15:16
Elastix RPM repo.
[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/
gpgcheck=0
enabled=1
<?php
$beanList['Opportunities'] = 'SOCustomOpportunity';
$beanFiles['SOCustomOpportunity'] = 'custom/modules/Opportunities/SOCustomOpportunity.php';
$objectList['Opportunities'] = 'Opportunity';
<?php
class AccountButtons {
function add()
{
// Based on what action we're in, add some buttons!
switch ($GLOBALS['app']->controller->action)
{
case "DetailView": // Add buttons to Detail View
<?php
class Accounts_logic_hook_class
{
function Accounts_logic_hook_method(&$bean, $event, $arguments)
{
echo "Hit the Accounts before save logic hook";
exit;
}
}
Add a Custom Field to a SugarCRM Module and execute custom PHP code in that field on the DetailView.
Is a 2 step process.
1) Have to modify the detailviewdefs.php file and add a CustomCode to your field in this file...
/custom/modules/<MODULE-NAME_FOLDER>/metadata/detailviewdefs.php
set a variable in a customCode key/value like this...
'customCode' => '{$STATUS}',
@melvinlee
melvinlee / UDPer.cs
Last active August 29, 2015 14:11 — forked from zmilojko/UDPer.cs
using System;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading;
namespace UDPer
{
class UDPer
{
@melvinlee
melvinlee / XmlSerialize.cs
Created December 22, 2014 06:26
Provide static methods for Xml Serialization and Deserialization
/**************************************************************************************
Version: 1.0
Provide static methods for Xml Serialization and Deserialization
***************************************************************************************/
using System;
using System.IO;
using System.Xml.Serialization;
public static class XmlSerialize