Skip to content

Instantly share code, notes, and snippets.

View mhamzas's full-sized avatar

M Hamza Siddiqui mhamzas

View GitHub Profile
@nicocrm
nicocrm / gist:858086
Created March 7, 2011 04:50
SalesForce Apex CSV Parser
/**
* Used to read a delimited file.
*/
public class SSSCsvReader {
private String delim = ',';
// the input data
private String[] buffer;
public SSSCsvReader(String data){
this.buffer = data.split('\n');
@tstachl
tstachl / DeskSample.java
Created April 13, 2013 02:07
Example talking to the Desk.com API from Salesforce (Apex).
public class DeskSample
{
private static String OAUTH_KEY = 'youroauthkey';
private static String OAUTH_SECRET = 'youroauthsecret';
private static String ACCESS_TOKEN = 'youraccesstoken';
private static String ACCESS_TOKEN_SECRET = 'youraccesstokensecret';
public static String DESK_SITENAME = 'yoursite';
public static Void doRequest()
@afawcett
afawcett / ant-salesforce.xml
Last active December 29, 2022 17:11
Defines some macros around sf:deploy to install and uninstall packages.
<!-- TODO: Review Ant v1.8 local properties -->
<project xmlns:sf="antlib:com.salesforce">
<!-- Download from Salesforce Tools page under Setup -->
<typedef
uri="antlib:com.salesforce"
resource="com/salesforce/antlib.xml"
classpath="${basedir}/lib/ant-salesforce.jar"/>
<!-- Download from http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ -->
@mxalix258
mxalix258 / Fiscal year calculations apex
Created August 27, 2013 01:06
Programatically find fiscal year values in apex
//for loop to find Opportunity Stages that are Closed and Won
for(OpportunityStage oppstage : oppstages){
if(oppstage.IsClosed == True && oppstage.IsWon == True){
wonstages.add(oppstage.MasterLabel);
}
}
Integer currentFY;
Integer currentFYMonth;
Integer CurrentFYDays;
Date today;
@JosefJezek
JosefJezek / proxmox-ve.md
Last active January 11, 2021 20:38
Proxmox VE
@omarstreak
omarstreak / background.js
Last active October 22, 2023 15:44
Chrome API Extension
//oauth2 auth
chrome.identity.getAuthToken(
{'interactive': true},
function(){
//load Google's javascript client libraries
window.gapi_onload = authorize;
loadScript('https://apis.google.com/js/client.js');
}
);
@peterknolle
peterknolle / AutocompleteController.cls
Last active December 29, 2022 17:11
Lightning Autocomplete Component
public class AutocompleteController {
@AuraEnabled
public static List<sObject> getSuggestions(String sObjectType, String term, String fieldsToGet, Integer limitSize) {
// could add in logic to remove possible duplicate fields
String fields = fieldsToGet.length() > 0 ? ',' + fieldsToGet : '';
String soql =
' SELECT Name, Id ' + String.escapeSingleQuotes(fields) +
' FROM ' + String.escapeSingleQuotes(sObjectType) +
' WHERE Name Like \'' + String.escapeSingleQuotes(term) + '%\'' +
@ostinelli
ostinelli / logentries_manual_setup.md
Last active August 11, 2022 21:37
How to use a single Logentries account on Heroku.

If you have multiple applications on Heroku and would like to use a single Logentries account for all of them, this is how you do it. Basically, do not use add-ons, and send all drains to your account.

  • In your Logentries account, click on Add Log
  • Select Manual
  • In the form that appears, input the following:
    • Log Name: access.log
    • Select Set: new set named myapp-{environment}, for instance myapp-staging (at least, this is how I like to name my entries)
    • Select the Plain TCP, UDP - logs are sent via syslog option
  • Click on Create Log Token
@jamesmacwhite
jamesmacwhite / Workarounds for Netflix and the blocking of IPv6 tunnels.md
Last active June 6, 2024 15:38
Prevent proxy/VPN streaming error messages from Netflix when using a Hurricane Electric IPv6 tunnel.

Workarounds for Netflix and the blocking of Hurricane Electric IPv6 tunnels

The dreaded "You seem to be using an unblocker or proxy." error message. Cool story bro.

This gist was essentially created out of my own rant about Netflix being hostile to IPv6 tunnel services since June 2016. You are welcome to read my opinion on the matter, this is the more technical side to the issue and how to combat it within your own network.

Since I wrote this, various GitHub users have contributed their thoughts and ideas which has been incorporated into this gist. Thank you to everyone who have contributed their own methods and implementations.

The problem

Netflix now treats IPv6 tunnel brokers (such as Hurricane Electric) as proxy servers. A while ago it became apparent to users and Netflix that somewhat by accident, IPv6 tunnel users were being served content outside of their geolocation because of the way Netflix was identifyi

@metadaddy
metadaddy / setup.sh
Last active February 14, 2023 08:06
Setup a SalesforceDX scratch org, open an IP range, check we can log in
#! /bin/bash
#
# Requires jq - see https://stedolan.github.io/jq/
#
# Assumes that the following env vars are set:
#
# CLIENT_ID - the client ID for your OAuth 2 app
# JWT_KEY_FILE - path to the private key for creating a JWT
# HUB_USERNAME - authentication username