Skip to content

Instantly share code, notes, and snippets.

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.com/install.sh | sh
@jamesrcounts
jamesrcounts / RecursiveSquare.java
Created April 16, 2015 15:48
Recursive Square Attempt
package org.teachingkidsprogramming.section05recursion;
import org.teachingextensions.logo.Tortoise;
public class RecursiveSquare
{
public static void main(String[] args) throws Exception
{
Tortoise.setSpeed(10);
double length = 100.0;
@jamesrcounts
jamesrcounts / starter.cmd
Created March 30, 2015 16:53
Minimal box starter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
choco install googlechrome
Install-WindowsUpdate
Set-ExecutionPolicy -Force Unrestricted
@jamesrcounts
jamesrcounts / index.html
Last active August 29, 2015 14:17
Highlight Match Directive
<!DOCTYPE html>
<html>
<head>
<title>AngularJS Tutorials</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/foundation/5.4.7/css/foundation.css">
</head>
<body>
<div ng-app="myApp">
<!-- we've replaced the use of $scope with the preferred "controller as" syntax. see: http://toddmotto.com/digging-into-angulars-controller-as-syntax/-->
@jamesrcounts
jamesrcounts / starter.cmd
Created March 20, 2015 16:35
vb6 boxstarter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
choco install googlechrome
choco install sublimetext2
choco install console2
choco install sourcecodepro
choco install githubforwindows
choco install tortoisemerge
choco install pscx
@jamesrcounts
jamesrcounts / if2hash.java
Created March 12, 2015 06:39
IF to Hash refactoring
//1) Starting code...
Color color;
if (branchLength == 10) {
color = PenColors.Greens.Lime;
} else if (branchLength == 20) {
@jamesrcounts
jamesrcounts / CreateHash.cs
Created December 11, 2014 20:20
Snippet to create a hash as a hex string
public static async Task<string> CreateHash(Stream stream)
{
byte[] b;
using (var ctx = new System.Security.Cryptography.SHA256Managed())
{
var input = await stream.ReadDataAsync();
b = ctx.ComputeHash(input);
}
@jamesrcounts
jamesrcounts / starter.cmd
Last active August 29, 2015 14:10
My Boxstarter Script
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
choco install VisualStudio2013Ultimate
choco install googlechrome
choco install sublimetext2
choco install console2
choco install sourcecodepro
choco install resharper
choco install stylecop
choco install git-credential-winstore
@jamesrcounts
jamesrcounts / VerifyConfig.cs
Last active August 29, 2015 14:07
Approve app.config
private static void VerifyConfig(string path, Action<Configuration> action)
{
using (var t = new TempFile(Path.GetRandomFileName()))
{
File.Copy(path, t.File.FullName, true);
var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = t.File.FullName };
var exeConfig = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
action.Invoke(exeConfig);
var config = File.ReadAllText(exeConfig.FilePath);
Approvals.Verify(config);
@jamesrcounts
jamesrcounts / MySqlCommandAdapter.cs
Created October 3, 2014 02:42
IDatabaseToExecuteableQueryAdaptor for MySql
// Note: Connection string must include the following option: Allow User Variables=True
using System;
using System.Data.Common;
using System.Linq;
using ApprovalUtilities.Persistence.Database;
using MySql.Data.MySqlClient;
public class MySqlCommandAdapter : IDatabaseToExecuteableQueryAdaptor