- GitHub Staff
- https://tippybits.com
- @dtaivpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.Xrm.Sdk; | |
namespace CRM.BusinessUnit.Plugins | |
{ | |
// Attributes used to simplify creating plugins | |
[StepMessage, StepEntity, SetpStage, StepMode, StepId] | |
[StepPreImage, PreImageId] | |
[StepPostImage, StepPostImageId] | |
public class org_ContactPreCreatePlugin : Pluginbase IPlugin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from csi-tai import CsiConnector, Endpoints, export_csv | |
# CsiConnector take a token and the endpoint URL | |
csi = CsiConnector('afwlf02394rjqw0494r034ifqojw4f', | |
'https://cloud.csiworld.com/VOWebAPI/v5/') | |
params = { | |
'filter': 'f.LName|o.eq|v.Tippett', | |
'fields': 'FName, LName', | |
'perpage':100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen_table_sql(table_obj): | |
row_len = length(table_obj) | |
query = "" | |
for index, row in enumerate(table_obj['columns']): | |
query.append(row) | |
# Needed so last line doesnt have a comma | |
if (index < length): | |
query.append(',\n') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen_table_sql(table_obj): | |
# Joins all rows with a comma and a newline except for the last | |
query = ',\n'.join(table_obj['columns']) | |
return query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen_table_sql(col_list): | |
# Joins all rows with a comma and a newline except for the last | |
query = ',\n'.join(col_list) | |
return query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def join_col_list(col_list): | |
'''Takes in column list and joins with commas to form sql statement''' | |
query = ',\n'.join(col_list) | |
return query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dictionary = {'string key': "string value", | |
('tuple', 'key'): {'dict': "value"}, | |
123: "Value for int key"} | |
keys = dictionary.keys() | |
print(keys) | |
# dict_keys(['string key', ('tuple', 'key'), 123]) | |
values = dictionary.values() | |
print(values) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialization | |
dictionary = {'string key': "string value", | |
('tuple', 'key'): {'dict': "value"}, | |
123: "Value for int key"} | |
# Assign a key a new value | |
dictionary[123] = "New Value" | |
# Retrieve all keys from a dictionary | |
keys = dictionary.keys() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialization | |
list = ["Lists", "Is", "Pretty", "Sweet"] | |
# Assigning an index a new value | |
list[1] = "Are" | |
# Extending a list | |
list.append("Cool") | |
# Removeing from the end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def memoize(f): | |
""" Memoization decorator for functions taking one or more arguments. """ | |
class memodict(dict): | |
def __init__(self, f): | |
self.f = f | |
def __call__(self, *args): | |
return self[args] | |
def __missing__(self, key): | |
ret = self[key] = self.f(*key) | |
return ret |
OlderNewer