This file contains 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
// add your Google API Project OAuth client ID and client secret here | |
var ClientID = ''; | |
var ClientSecret = ''; | |
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
ui.createMenu('Google Fit') | |
.addItem('Authorize if needed (does nothing if already authorized)', 'showSidebar') | |
.addItem('Get Steps for Yesterday', 'getSteps') | |
.addItem('Get Steps for past 30 days', 'getHistory') |
This file contains 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
// load word2vec model | |
_vocabulary = new Word2VecBinaryReader().Read(HostingEnvironment.MapPath("~/App_Data/GoogleNews-vectors-negative300-SLIM.bin")); | |
// ... collect all words in post (words is List<string>, not included as implementation specific) ... | |
double[] vector = new double[_vocabulary.VectorDimensionsCount]; | |
// add all words that exist in the vocabulary | |
int inVocabularyCount = 0; | |
foreach(string word in words) |
This file contains 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
<Custom Action="InstallSS" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom> |
This file contains 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
<Shortcut Id='SettingsLink' | |
Directory='ProgramMenuDir' | |
Name='Settings' | |
LongName='Screen Saver Settings' | |
WorkingDirectory='SystemFolder' | |
Target='[SystemFolder]rundll32.exe' | |
Arguments='desk.cpl,InstallScreenSaver the.scr'/> |
This file contains 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
<CustomAction Id='InstallSS' | |
Directory='SystemFolder' | |
ExeCommand='rundll32.exe desk.cpl,InstallScreenSaver the.scr' | |
Return='asyncNoWait'/> |
This file contains 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
public static string OAuthUrlEncode(string s) | |
{ | |
if (string.IsNullOrEmpty(s)) | |
{ | |
return string.Empty; | |
} | |
else | |
{ | |
StringBuilder sb = new StringBuilder(s.Length); |
This file contains 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
private const string NoEncodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~"; |
This file contains 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
App.Current.DispatcherUnhandledException += | |
new DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException); | |
AppDomain.CurrentDomain.UnhandledException += | |
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
This file contains 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
void someEvent_Handler(object sender, SomeEventEventArgs e) | |
{ | |
if (this.Dispatcher.CheckAccess()) | |
{ | |
// do work on UI thread | |
} | |
else | |
{ | |
// or BeginInvoke() | |
this.Dispatcher.Invoke(new Action(someEvent_Handler), |
This file contains 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
private XImage ScanOne() | |
{ | |
XImage ximage = null; | |
try | |
{ | |
// find our device (scanner previously selected with commonDialog.ShowSelectDevice) | |
DeviceManager manager = new DeviceManager(); | |
DeviceInfo deviceInfo = null; | |
foreach (DeviceInfo info in manager.DeviceInfos) |
OlderNewer