Skip to content

Instantly share code, notes, and snippets.

View lefthandedgoat's full-sized avatar

Chris Holt lefthandedgoat

View GitHub Profile
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>canopy</id>
<version>2.0.0</version>
<authors>Chris Holt</authors>
<licenseUrl>https://github.com/lefthandedgoat/canopy/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>http://lefthandedgoat.github.io/canopy/</projectUrl>
<iconUrl>http://lefthandedgoat.github.io/canopy/canopy_orig.jpg</iconUrl>
<description>A simple framework in F# on top of selenium for writing UI automation and tests.</description>
@lefthandedgoat
lefthandedgoat / esc.ahk
Created May 18, 2017 19:19
auto hot key script to have capslock double up as esc and ctrl and have left shit and right shift add parenthesis
;be sure to run AHK et all as administrator
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
@lefthandedgoat
lefthandedgoat / init.el
Created April 4, 2017 17:37
my emacs config
;; require package managers, but we'll avoid them if at all possible
(require 'package)
(push '("melpa" . "http://melpa.milkbox.net/packages/")
package-archives)
;;=====================================
;;plugins
;;=====================================
@lefthandedgoat
lefthandedgoat / gist:25e5bc05f8c631c2d9885ace4f4169a6
Created February 11, 2017 16:55
working fsx with html reporter
#I @"C:\projects\fsxCanopy\packages\Selenium.WebDriver.3.0.0\lib\net40\"
#I @"C:\projects\fsxCanopy\packages\canopy.1.0.6\lib"
#r "WebDriver.dll"
#r "canopy.dll"
open canopy
open runner
open reporters
module Test1
open Xunit
open FsUnit.Xunit
type ``Context 1`` () =
let setup = failwith "do your setup here and if it returns unit its fine, it will bind to the setup val"
[<Fact>]
member x.``test 1`` () =
@lefthandedgoat
lefthandedgoat / connect4.fs
Created September 28, 2016 23:21
Connect 4
type Color =
| Red
| Yellow
type Spot =
| Empty
| Color of Color
type Column =
| A

Keybase proof

I hereby claim:

  • I am lefthandedgoat on github.
  • I am lefthandedgoat (https://keybase.io/lefthandedgoat) on keybase.
  • I have a public key whose fingerprint is 2605 18F6 0853 C366 17CE D7C2 013C B074 F73F 4256

To claim this, I am signing this object:

@lefthandedgoat
lefthandedgoat / gist:123aff8504981843ce25
Created January 31, 2016 17:31
Quick list of things to check for related to website performance
Off the top of my head, there are multiple parts of making your site faster.
1. Network related stuff
2. Server side time
3. Client side time
The tool that will give you the quickest high level insight into some things you may be wrong is:
http://yslow.org/
It will lead you to some quick wins like, expiration headers, gzip compression, etc.
It gives you a nice score and with a few hours of work you can usually fix several of the issues.
open canopy
open runner
start firefox
pin types.FullScreen
url "https://www.google.com/?gws_rd=ssl#q=cats"
let elems = elements ".g .r a"
elems |> List.iter (fun e -> printfn "%s || %s" e.Text (e.GetAttribute("href")))
@lefthandedgoat
lefthandedgoat / gist:18464c3a14e5b98c24a5
Last active January 11, 2018 12:45
What to talk about in a canopy presentation
  • People (usually no F# exposure) always want to understand what &&& is ex:
    • "Some test" &&& fun _ -> url "http://www.google.com"
    • To explain this I teach them about infix operators which also helps with them understand why you can do "#name" == "Bob" and with |>
  • Its good to point out that canopy uses selenium and does not hide it at all. If you need to do something that canopy does not support, you can google for it and take the example and convert it to f#. browser is the instance of ISeleniumWebDriver
  • UI Automation works really well but is a pain because its sometimes more precise that people care about. It will uncover subtle bugs that people often time don't want to research and fix =(
  • A great property of F# is that the most recent definition of a function is the one that is used. This lets you 'override' core functionality with some that is better for you. ex if you dont like how displayed works, you can create your own version and put it in a module and open it after op