Skip to content

Instantly share code, notes, and snippets.

View cdeutsch's full-sized avatar
👨‍🏭
Hire me! Fullstack Engineer open to new developer or manager opportunities.

C Deutsch cdeutsch

👨‍🏭
Hire me! Fullstack Engineer open to new developer or manager opportunities.
View GitHub Profile
using System;
using System.ComponentModel;
namespace XamarinStore
{
public enum ProductType
{
Shirt,
Plushie
}
@cdeutsch
cdeutsch / gist:7048690
Last active December 25, 2015 22:19
Empty Salesforce Accounts
SELECT Id, Name, CreatedDate, LastModifiedDate
FROM (
SELECT Id, Name, CreatedDate, LastModifiedDate
FROM OPENQUERY(DBAMP, 'select * from Account')
WHERE Account_Profile__c IS NULL
AND Account_Stage__c IS NULL
AND Account_Tier__c IS NULL
AND AccountNumber IS NULL
AND Annual_Revenue_in_millions__c IS NULL
AND AnnualRevenue IS NULL
@cdeutsch
cdeutsch / gist:7073149
Created October 20, 2013 18:08
Expand Stripe default_card
var client = new StripeClient(SiteSettings.StripeApiKey);
dynamic response = client.RetrieveCustomer(user.CustomerIdentifier);
if (response.IsError)
{
this.FlashError((string)response.error.message);
}
else
{
// expand default_card
analytics.identify (userData['email'], {
email: userData['email'],
firstName: userData['firstName'],
lastName: userData['lastName'], // trailing comma breaks IE8
});
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.17020
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
using System;
@cdeutsch
cdeutsch / gist:7241538
Last active December 27, 2015 00:59
Better Marketo / Salesforce munchkin.js loading that won't fire initMunchkin twice in IE.
<script type="text/javascript">
(function() {
function initMunchkin() {
Munchkin.init('YOUR-ID');
// custom handling after marketo is ready
if (typeof marketo_ready != 'undefined') marketo_ready();
}
var s = document.createElement('script');
doImageGet: function(a, b, c, d, e) {
var b = a + b + "&" + this.$.param(c), f = false, a = new Image(1, 1);
a.onload = function() {
f = true;
_MchHlpr.isDefined(e) && e()
};
a.src = b;
if (d > 0)
for (b = (new Date).getTime(); !f; )
if ((new Date).getTime() - b > d)
@cdeutsch
cdeutsch / gist:7378297
Created November 8, 2013 21:53
Mandrill example
var emailMessage = new EmailMessage
{
to = new List<EmailAddress>() { new EmailAddress() { email = model.Email, name = model.ShippingName } },
track_clicks = true,
track_opens = true
};
emailMessage.AddGlobalVariable("shipping_name", model.ShippingName.EmptyIfNull());
emailMessage.AddGlobalVariable("base_url", GetBaseUrl());
emailMessage.AddGlobalVariable("address1", model.Address1.EmptyIfNull());
@cdeutsch
cdeutsch / gist:7497163
Last active December 28, 2015 11:59
Redirect if browser is mobile
public function actionMobileLogin()
{
$this->layout = 'mobile';
Yii::app()->user->setState('loginType', 'mobile');
$this->actionLogin(true);
}
public function actionLogin($skipMobileCheck = false)
from c in charges
from componentVersion in allComponents
where c.Timestamp.Month == Month
&& c.Timestamp.Year == Year
&& !c.Refunded
&& !c.ChargeSource.Equals ("comp", StringComparison.OrdinalIgnoreCase)
&& c.ComponentID == componentVersion.ID
orderby c.Timestamp descending
select c;