Skip to content

Instantly share code, notes, and snippets.

View sergey-tihon's full-sized avatar
🦀

Sergey Tihon sergey-tihon

🦀
View GitHub Profile
public List<Dependency> GetDependency(Tree tree)
{
var tlp = new PennTreebankLanguagePack();
var gsf = tlp.grammaticalStructureFactory();
var gs = gsf.newGrammaticalStructure(tree);
var dependencies = gs.typedDependenciesCollapsedTree();
return (from TypedDependency dependency in dependencies.toArray()
select new Dependency
{
@sergey-tihon
sergey-tihon / gist:51e21e328454567594f4
Created November 13, 2014 19:53
Joke radio powered by COM Type Provider
#r "../packages/FSharp.ComProvider.1.0.0-pre1/lib/net40/FSharp.ComProvider.dll"
#r @"../packages/FSharp.Data.2.1.0/lib/net40/FSharp.Data.dll"
open FSharp.Data
type SpeechService = TypeLib.``Microsoft Speech Object Library``.``5.4``
let speech = SpeechService.SpVoiceClass()
type js = JsonProvider<"""{ "type": "success", "value": { "id": 42, "joke": "Joke here." } }""" >
let getJoke num =
// include Fake libs
#r @"c:\Project\FAKE.Deploy\bin\FAKE\tools\FakeLib.dll"
open Fake
open System
open System.IO
let targetDirectory = @"c:\Project\Service.MSO"
let runScript file =
if File.Exists file then
@sergey-tihon
sergey-tihon / search.js
Created March 26, 2012 15:16
preview fetching
FST_PreviewRequests = [];
function FST_RegisterDocPreviewFetch(a) {
ULShpi: ;
FST_PreviewRequests.push(a)
}
var gTotReq = 0,
gTotReqSent = 0;
function FST_StartDocPreviewFetch(b, c) {
@sergey-tihon
sergey-tihon / init.js
Created March 27, 2012 11:56
e-mail a link
function navigateMailToLink(a) {
ULSA13: ;
window.location = "mailto:?body=" + escapeProperly(a)
}
@sergey-tihon
sergey-tihon / init.js
Created March 27, 2012 12:06
GetUrlKeyValue
function GetUrlKeyValue(d, e, a) {
ULSA13: ;
var c = "";
if (a == null) a = window.location.href + "";
var b;
b = a.indexOf("#");
if (b >= 0) a = a.substr(0, b);
b = a.indexOf("&" + d + "=");
if (b == -1) b = a.indexOf("?" + d + "=");
if (b != -1) {
@sergey-tihon
sergey-tihon / masterpage.master
Created March 27, 2012 16:19
script loading
before:
<body onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
after:
<script type="text/javascript">
var attempts_remain = 200;
function _lazySpBodyOnLoadWrapper() {
if (typeof(_spBodyOnLoadWrapper) == 'undefined' || !(document.readyState === "complete")) {
if (attempts_remain > 0) {
attempts_remain--;
@sergey-tihon
sergey-tihon / gist:2838208
Created May 30, 2012 18:41
How to update SPListItem Created/Modified date
using System;
using Microsoft.SharePoint;
namespace EPAM.USPS.SharePoint.Core.Utilities.Specific
{
public class ListItemPropertySet
{
public ListItemPropertySet()
{
}
open System.IO;
let rec getAllDirectories dir =
Directory.GetDirectories(dir)
|> Array.collect getAllDirectories
|> Array.append [|dir|]
let directoryName = System.Environment.GetCommandLineArgs().[1]
@sergey-tihon
sergey-tihon / SourceDocumentBuilder.cs
Created September 28, 2012 13:41
ISource for DocumentBuilder
/***************************************************************************
Copyright (c) Microsoft Corporation 2011.
This code is licensed using the Microsoft Public License (Ms-PL). The text of the license can be found here:
http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
***************************************************************************/