Skip to content

Instantly share code, notes, and snippets.

View AlunHewinson's full-sized avatar
💭
R-ing my way across past Advents of Code

Alun Hewinson AlunHewinson

💭
R-ing my way across past Advents of Code
View GitHub Profile
@AlunHewinson
AlunHewinson / index.html
Created February 27, 2015 12:03
Scatterplot
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='//ramnathv.github.io/rCharts/libraries/widgets/polycharts/js/polychart2.standalone.js' type='text/javascript'></script>
<style>
.rChart {
display: block;

Keybase proof

I hereby claim:

  • I am alunhewinson on github.
  • I am alunhewinson (https://keybase.io/alunhewinson) on keybase.
  • I have a public key whose fingerprint is 3151 4137 5556 62CA EE48 7C56 7E98 3241 3EE7 B175

To claim this, I am signing this object:

@AlunHewinson
AlunHewinson / Excel VBA to find next permutation or list of permutations
Last active December 16, 2015 09:19
Function to find the next permutation after a given permutation in Excel. The function NextPerm is used as in the following example: =NextPerm("acdeb") This gives the result acebd. The function can be used to produce a list of permutations like so: In cell A1 type your starting permutation, e.g. "ABCDE" In cell A2 enter =NextPerm(A1) (you should…
Function NextPerm(ByVal strIndex As String)
nChanger = FindChanger(strIndex)
If nChanger = 0 Then
NextPerm = SortAscending(strIndex)
Exit Function
End If
strNextStart = Left(strIndex, nChanger - 1)
strNextEnd = StepEndUp(Mid(strIndex, nChanger))
NextPerm = strNextStart & strNextEnd
End Function
@AlunHewinson
AlunHewinson / Excel VBA paste special values from multiple sources
Created April 15, 2013 13:26
A shortcut key to paste special value in Excel is incredibly useful to me. Sometimes, though, the code would break if I was pasting from text copied from a website. This tries the second type of paste if the first errors. You just need to assign a shortcut key to the macro; I use ctrl-m.
Sub PasteValues()
On Error GoTo txt
Selection.PasteSpecial Paste:=xlPasteValues
Exit Sub
txt:
If ActiveCell.MergeCells Then
Application.DisplayAlerts = True
Dim DObj As MSForms.DataObject
Dim s As String
Set DObj = New MSForms.DataObject