Skip to content

Instantly share code, notes, and snippets.

Avatar
☁️
Catfood Earth 4 released with all images remastered to 4K

Robert Ellison abfo

☁️
Catfood Earth 4 released with all images remastered to 4K
View GitHub Profile
View Code.gs
// 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')
View snippet.cs
// 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)
View screen-saver-install-wix.xml
<Custom Action="InstallSS" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
View screensaver-settings-link-wix.xml
View screen-saver-settings-wix.xml
<CustomAction Id='InstallSS'
Directory='SystemFolder'
ExeCommand='rundll32.exe desk.cpl,InstallScreenSaver the.scr'
Return='asyncNoWait'/>
View OAuthUrlEncode.cs
public static string OAuthUrlEncode(string s)
{
if (string.IsNullOrEmpty(s))
{
return string.Empty;
}
else
{
StringBuilder sb = new StringBuilder(s.Length);
View NoEncodeChars.cs
private const string NoEncodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
View App.xaml.cs
App.Current.DispatcherUnhandledException +=
new DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
View SomeEventHandler.cs
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),
View ScanOne.cs
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)
You can’t perform that action at this time.