Skip to content

Instantly share code, notes, and snippets.

@f1code
f1code / AddReturnProduct.ascx.cs
Last active October 23, 2015 14:21
InforCRM - Custom search form
// In AA: I created a "Panel" placeholder and set the column span to 2
// I can't use the placeholder directly because it is itself a dijit
// form load method:
String appPath = Request.ApplicationPath;
ScriptManager.RegisterStartupScript(this, GetType(), "AddReturnProduct",
@"require({ packages: [{ name: 'Martin', location: '" + appPath +
@"/MartinEng/js'}] }, ['Martin/Return/AddReturnProduct'], function(AddReturnProduct) {
var s = new AddReturnProduct({});
dojo.place(s.domNode, dojo.byId('" + placeholder.ClientID + @"').parentElement, 'only');
@f1code
f1code / ProductsGridHelper.js
Created October 26, 2015 13:13
Used to customize the grid without having to modify the code in Application Architect (I use it to apply same customizations to Opportunity and Sales Order product grids)
// Helper for the products grid used at the SalesOrder and Opportunity levels
define(['dojo/_base/declare', 'dojo/aspect'], function (declare, aspect) {
var Helper = declare([], {
grid: null,
constructor: function(grid) {
this.grid = grid;
this.setupDefaultProgram();
this.setupProductFilter();
},
@f1code
f1code / ProductsGridHelper-MoveUpDown.js
Last active October 26, 2015 23:14
Move Up / Move Down buttons for InforCRM (code for https://nicocrm.wordpress.com/?p=562)
// Helper for the products grid used at the SalesOrder and Opportunity levels
define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/aspect', 'dojo/on', 'Sage/UI/Dialogs'],
function (declare, lang, aspect, on, slxDialogs) {
var Helper = declare([], {
grid: null,
constructor: function (grid) {
this.grid = grid;
this.setupMoveUpDownHandlers();
},
@f1code
f1code / CustomInforColorScheme.css
Last active November 6, 2015 15:10
Customize color scheme for InforCRM
/* Custom style scheme for InforCRM */
/* Using #EB6800 as primary color */
/* Using #E37221 as link color */
.dijitTab,
.dijitTab .dijitTabInnerDiv,
.dijitTabListWrapper,
#MainHeader,
#titlePane,
@f1code
f1code / QuickSearch.ascx
Created November 10, 2015 15:53
InforCRM Quick Search - For InforCRM 8.2
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="QuickSearch.ascx.cs" Inherits="SmartParts_Contact_QuickSearch" %>
<%@ Register Assembly="Sage.SalesLogix.Web.Controls" Namespace="Sage.SalesLogix.Web.Controls.PickList" TagPrefix="SalesLogix" %>
<%@ Register Assembly="Sage.SalesLogix.Web.Controls" Namespace="Sage.SalesLogix.Web.Controls" TagPrefix="SalesLogix" %>
<%@ Register Assembly="Sage.SalesLogix.Web.Controls" Namespace="Sage.SalesLogix.Web.Controls.Lookup" TagPrefix="SalesLogix" %>
<%@ Register Assembly="Sage.SalesLogix.HighLevelTypes" Namespace="Sage.SalesLogix.HighLevelTypes" TagPrefix="SalesLogix" %>
<style type="text/css">
.date input {
width: 7em;
}
@f1code
f1code / library.php
Created November 14, 2015 15:44
Super simple, ugly and insecure PHP script for sharing files
<form enctype="multipart/form-data" method="POST">
<input type="file" name="upload"/>
<input type="submit" value="Submit"/>
</form>
<?php
$uploads_dir = "uploads/";
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if(move_uploaded_file($_FILES['upload']['tmp_name'], $uploads_dir . basename($_FILES['upload']['name']))){
@f1code
f1code / salts.php
Created November 23, 2015 13:58
Script for generating WP secret keys (like https://api.wordpress.org/secret-key/1.1/salt/, but suitable to use in .env file)
<?php
function generate_salt($length) {
$seed = 'abcdefghijklmnopqrstuvwxyz'
.'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
.'0123456789!@#$%^&*()"'; // and any other characters
$rand = substr(str_shuffle(str_repeat($seed, $length)), 0, $length);
return $rand;
}
@f1code
f1code / create-vhost.py
Created November 24, 2015 15:50
Create new virtualhost in WAMP
import sys, os, errno
from subprocess import call
HOSTS_FILE = "C:\\Windows\\System32\\drivers\\etc\hosts"
VHOSTS_FILE = "C:\\wamp\\bin\\apache\\apache2.4.9\\conf\\extra\\httpd-vhosts.conf"
WAMP_ROOT = "C:\\wamp\\www"
APACHE_SERVICE_NAME = "wampapache64"
def add_host_name(hostname):
text = "127.0.0.1 %(hostname)s %(hostname)s.local\n" % \
@f1code
f1code / simple_lightbox.js
Created November 30, 2015 11:46
Super simple lightbox... I feel like I have implemented this 10 times recently... This is more a base than a ready-to-use script.
function closeLightbox() {
$('.pledge_dialog_overlay').remove();
}
function centerDialog(content) {
var height = content.height();
var winHeight = $(window).height();
var spacing = Math.max(0, (winHeight - height) / 2);
var top = $(window).scrollTop() + spacing;
// in case there is a header bar... try to find where the content starts
@f1code
f1code / gallery.css
Last active January 24, 2016 21:44
Responsive thumbnail gallery using the Wordpress API