Skip to content

Instantly share code, notes, and snippets.

View daviwil's full-sized avatar

David Wilson daviwil

View GitHub Profile
@daviwil
daviwil / 003_1_initial_code.fs
Created August 26, 2016 14:03
Source code from Episode 003 of the_dev_aspect
//
// --------- Model ---------
//
type Details =
{ Name: string
Description: string }
type Item =
{ Details: Details }

Keybase proof

I hereby claim:

  • I am daviwil on github.
  • I am daviwil (https://keybase.io/daviwil) on keybase.
  • I have a public key ASA0mIVzmnEvnH5J36WzAIUu24J_GQCS6WfjAD6nctAeVgo

To claim this, I am signing this object:

@daviwil
daviwil / VSCodeDeepDive.md
Created April 13, 2017 13:38
The notes from my session "Authoring in VS Code" at the 2017 PowerShell and DevOps Global Summit in Bellevue, WA.

Visual Studio Code Deep Dive

David Wilson - @daviwil Software Engineer, PowerShell Team

Overview

  1. Visual Studio Code overview
  2. Configuring the editor
  3. Extensions
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class NativeConsoleMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr GetStdHandle(int handleId);
@daviwil
daviwil / 00-lenovo-x1-5th-gen-thinkfan-setup.md
Created January 1, 2018 17:28 — forked from abn/00-lenovo-x1-5th-gen-thinkfan-setup.md
Fedora thinkfan configuration for Lenovo X1 Carbon (5th Gen)

Thinkfan Configuration Notes

This are notes for configuration thinkfan for Fedora. This configuration procedure was followed on a Lenovo Thinkpad X1 Carbon (5th Gen) running Fedora 25.

Non standard (default) configuration was required for this machine as the default sensors are not available. Eg: /proc/acpi/ibm/thermal does not exist for this model.

An annoted configuration file has been included below. However, there is no guarentee that this will work as-is on every machine.

Installation

dnf -y install thinkfan

Azure Cognitive Services Text Analytics for Healthcare

AutoRest Configuration

see https://aka.ms/autorest

Input Files

input-file:
 - https://github.com/iscai-msft/azure-rest-api-specs/blob/dev-cognitiveservices-TextAnalytics-healthcare-v3.1-preview.2/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.2-preview.1/TextAnalytics.json

#+title Lua Tangling Example

Write out the files with org-babel-tangle!

Original Content

(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("elpa" . "https://elpa.gnu.org/packages/")))

The issue with the code turns out to be a facet of how macros work. This macro accepts a parameter num, but based on macro eval rules, num itself is actually the original symbol you passed into the function since macro arguments are never evaluated before they are given to the macro body.

With backquoting you can extract the actual value of num, but you won’t be able to do it for the intern call because it’s being evaluated in the macro expansion pass (no access to the value of num). You would need to pass a number literal in for num for this to work, and that’s why your manual invocations were working.

(defmacro ct/tab-bar-select-action-define (num)
  `(defun ,(intern (format "ct/tab-bar-select-%d" num)) ()
     ,(format "Select tab %d by its absolute number." num)
     (interactive)