Skip to content

Instantly share code, notes, and snippets.

View dhonig's full-sized avatar

Daniel Honig dhonig

View GitHub Profile
@dhonig
dhonig / SugarCRMSoapClient.java
Created June 5, 2012 18:12
SugarCRM MD5 example
*/
public String login() {
UserAuth userAuth = new UserAuth();
userAuth.setUserName(username);
userAuth.setPassword(password);
try {
EntryValue loginRes = wsClient.login(userAuth, Class.class.getName(), new NameValueList());
return loginRes.getId();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
@dhonig
dhonig / NameValueList.java
Created June 5, 2012 20:16
NamveValueList
/**
* Mule Sugar CRM Connector
*
* Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
*
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
@dhonig
dhonig / DeployAppToIon.groovy
Created June 5, 2012 23:15
Attempt to deploy to ION
import static groovyx.net.http.ContentType.JSON
import groovyx.net.http.RESTClient
import static groovyx.net.http.Method.GET
import static groovyx.net.http.Method.PUT
import static groovyx.net.http.ContentType.TEXT
import static groovyx.net.http.ContentType.URLENC
@Grab(group = 'org.codehaus.groovy.modules.http-builder',
module = 'http-builder', version = '0.5.2')
@dhonig
dhonig / franklinmint-mule.xml
Created June 11, 2012 22:03
this actually works
<flow name="net_suite_test_flow">
<http:inbound-endpoint ref="netsuite_test_endpoint" exchange-pattern="request-response"/>
<logger message="#[groovy:return message.toString();]" level="INFO"/>
<echo-component/>
<netsuite:get-record recordType="INVENTORY_ITEM" id="#[header:INBOUND:internal_id]"/>
<logger message="#[groovy:return message.toString();]" level="INFO"/>
<expression-transformer>
<return-argument evaluator="string" expression="Item: #[groovy:message.payload.storeDescription]"/>
</expression-transformer>
<netsuite:add-list recordType="CASH_SALE">
@dhonig
dhonig / gist:6335851
Created August 25, 2013 19:45
MULE startup failure
at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)
Caused by: org.mule.api.config.ConfigurationException: Line 43 in XML document from URL [file:/usr/lib/mule-standalone-3.4.0/apps/itemize-esb-1.0.0-SNAPSHOT/main.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'amqp:connector'. One of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://
<ListOfEmails>
<Email>
<EmailOID>57712b2a-ab68-4d59-94e9-fd22aaab7c89</EmailOID>
<Sender>Jai King &lt;herqueles3@gmail.com></Sender>
<DateTime>2013-09-06T19:16:22.308Z</DateTime>
<Subject>test subject</Subject>
<ListOfDocuments/>
</Email>
<Email>
<EmailOID>75a0b993-186b-49a5-968f-111cf985866f</EmailOID>
@dhonig
dhonig / BooYah
Created April 2, 2014 09:18
EXAMPLE Filtering within a term query
POST /development_en/product/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"match_all": {}
}
context "Searching" do
let!(:taxon) { create(:taxon, name: "shirts") }
let!(:taxon2) { create(:taxon, name: "shoes") }
let!(:a_product) { create(:product, taxons: [taxon], stores: [store],
description: "A product in english", price: 20) }
let!(:another_product) { create(:product, taxons: [taxon, taxon2], stores: [store], price: 80) }
end
@dhonig
dhonig / gist:f2ca099053afe9ca4f31
Created September 10, 2015 16:54
turn off admin alerts
RAILS_ENV=production bundle exec rails runner "Spree::Config.check_for_spree_alerts = false"
def update!(target = nil)
return amount if closed?
if source.present?
amount = source.compute_amount(target || adjustable)
self.update_columns(
amount: amount,
updated_at: Time.now,
)
if promotion?
self.update_column(:eligible, source.promotion.eligible?(adjustable))