Skip to content

Instantly share code, notes, and snippets.

View rrreese's full-sized avatar

Robert Anton Reese rrreese

View GitHub Profile
<script src="hexagon.js"></script>
<canvas id="HexCanvas" width="1000" height="700"></canvas>
<script>
var hexagonGrid = new HexagonGrid("HexCanvas", 50);
hexagonGrid.drawHexGrid(7, 10, 50, 50, true);
</script>
javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://raw.github.com/rrreese/SafariBooksStyleReplace/master/styleReplace.js';})();
@rrreese
rrreese / italics
Created October 3, 2013 18:45
Scite Bold/Italicise Selection
function HTMLItalics()
local sel = editor:GetSelText()
editor:ReplaceSel("&lt;i&gt;"..sel.."&lt;/i&gt;")
end
@rrreese
rrreese / calc
Created October 3, 2013 18:19
Scite Word Count
--Calculate whitespace control
for m in editor:match("\n") do --count newline
whiteSpace = whiteSpace + 1;
end
for m in editor:match("\r") do --count carriage return
whiteSpace = whiteSpace + 1;
end
for m in editor:match("\t") do --count tabs
whiteSpace = whiteSpace + 1;
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="ctl00_ctl00_Head1"><title>
World Consumer Income and Expenditure Patterns
@rrreese
rrreese / 1ParallelTest.cs
Created November 18, 2012 11:16
A look at the Parallel class, .Net 4.0's new functionality to simplify multi-threading.
class ParallelTest
{
class TestObject
{
public string Name { get; set; }
public int Number { get; set; }
public override string ToString()
{
return Name;
@rrreese
rrreese / 1Historical.cs
Created November 18, 2012 11:08
.NET Code Contracts
public static int Divide(int number, int divisor)
{
if (divisor == 0) throw new Exception();
@rrreese
rrreese / Registry.xml
Created November 18, 2012 10:56
WiX Registry
<RegistryKey Action="createAndRemoveOnUninstall"
Key="Software\Wixtest\ExampleKey"
Root="HKLM">
<RegistryValue Name="Test" Type="string" Value="Test Value" />
</RegistryKey>
@rrreese
rrreese / 1ServiceInstall.xml
Created November 18, 2012 10:53
Installing and Starting Windows Services with WiX
<ServiceInstall Id="TestServiceID"
Name="testService"
Type="ownProcess"
ErrorControl="normal"
Start="auto" >
<⁄ServiceInstall>
<File Id="testFile1" Name="testFile1.exe" Source="E:\Documents\TestFile1.exe" KeyPath="yes"⁄>
<File Id="testFile2" Name="testFile2.txt" Source="E:\Documents\TestFile2.txt" ⁄>
@rrreese
rrreese / 1Namespace.xml
Created November 18, 2012 09:41
Configuring XML with WiX
<Wix XMLns="http:⁄⁄schemas.microsoft.com⁄wix⁄2006⁄wi"
XMLns:util="http:⁄⁄schemas.microsoft.com⁄wix⁄UtilExtension">