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-settings-wix.xml
<CustomAction Id='InstallSS'
Directory='SystemFolder'
ExeCommand='rundll32.exe desk.cpl,InstallScreenSaver the.scr'
Return='asyncNoWait'/>
View screen-saver-install-wix.xml
<Custom Action="InstallSS" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
View screensaver-settings-link-wix.xml
View Blend.cs
private static void SimpleBlend(string image1path, string image2path, byte alpha)
{
using (Bitmap image1 = (Bitmap)Bitmap.FromFile(image1path))
{
using (Bitmap image2 = (Bitmap)Bitmap.FromFile(image2path))
{
// update the alpha for each pixel of image 2
for (int x = 0; x < image2.Width; x++)
{
for (int y = 0; y < image2.Height; y++)
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),