Skip to content

Instantly share code, notes, and snippets.

@MartinBodocky
MartinBodocky / gist:7984439
Last active March 10, 2020 17:50
Get Calendar recurrent events by CSOM from SharePoint 2013.
GetItemsFromCalendarAsmx = function (webUrl, calendarGuid) {
wsURL = webUrl + "_vti_bin/Lists.asmx";
var xmlCall =
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> <soap:Body>" +
"<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>" + calendarGuid + "</listName>" +
"<query>" +
"<Query>" +
@MartinBodocky
MartinBodocky / gist:8056791
Created December 20, 2013 15:58
How to create and get Field Choice in SharePoint 2013 by REST
GetFieldsFromCollectionREST = function (restUrl, properties) {
var values = [];
select = "$select="
if (properties.length > 1)
select += _(properties.slice(1)).reduce(function (memo, item) { return memo + "," + item }, properties[0]);
else
select += properties[0];
if (restUrl.indexOf('?') > -1)
restUrl = restUrl + "&" + select;
else
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>fs</string>
<string>fsi</string>
<string>fsx</string>
</array>
let snacks = ("Soda", "Cookies", "Candy")
let x, y, z = snacks
let tens = [0 .. 10 ..50]
let countDown = [5L .. -1L .. -5L]
let x2 =
[ let negate x = -x
for i in 1 .. 10 do
if i % 2 = 0 then
//Mutable record types
open System
type MutableCar =
{
Make : string
Model : string
mutable Miles : int
}
let driveForAReason (car : MutableCar) : unit =
@MartinBodocky
MartinBodocky / asyncParallel
Last active August 29, 2015 13:58
Asynchronous and Parallel Programming in F#
// Creating new threads
open System
open System.Threading
//What will execute on each thread
let threadBody() =
for i in 1..5 do
//Wait 1/10 of a second
Thread.Sleep(100)
printfn "[Thread %d] %d ..."
@MartinBodocky
MartinBodocky / simpleKNN
Created April 14, 2014 23:49
Simple KNN
let distance v1 v2 =
Array.zip v1 v2
|> Array.fold (fun sum e -> sum + pown (fst e - snd e) 2) 0.0
|> sqrt
let classify subject dataSet labels k =
dataSet
|> Array.map (fun row -> distance row subject)
|> Array.zip labels
|> Array.sortBy snd
@MartinBodocky
MartinBodocky / gist:11124032
Created April 20, 2014 20:12
Doing Data Science Chap2 Exercise
#doing data science chapter 2
setwd("~/GitHub/doing_data_science/dds_datasets")
#read dataset to memory
data <- read.csv("dds_ch2_nyt/nyt1.csv")
#categorize
head(data)
dim(data)
data$agecat <- cut(data$Age, c(-Inf,0,18,24,34,44,54,64,Inf))
@MartinBodocky
MartinBodocky / LinearRegression.py
Created April 25, 2014 00:53
First linear regression in Python
__author__ = 'martinbodocky'
from numpy import *
import matplotlib.pyplot as plt
import csv
def loadDataSet(filename):
"""Load CSV comma formatted file without header,
which contains features values and target value in last column
@MartinBodocky
MartinBodocky / pandas.py
Last active August 29, 2015 14:00
Learning about Python library Pandas
__author__ = 'martinbodocky'
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
obj = Series([4, -7, 5, 3])
obj.values
obj.index