Skip to content

Instantly share code, notes, and snippets.

View cartermp's full-sized avatar
🦫
reject modernity, become a beaver

Phillip Carter cartermp

🦫
reject modernity, become a beaver
View GitHub Profile
@cartermp
cartermp / MrMittensTheKitten.md
Last active August 29, 2015 14:11
More in-depth sample

WuTang4Eva

StringExtensions

Provides extension methods for semantic string support.


IsNullOrWhiteSpace(System.String)
@cartermp
cartermp / XmlToMarkdown.cs
Created December 8, 2014 19:29
Converts a Visual Studio XML Documentation File into Equivalent Markdown. Modified from here: https://gist.github.com/lontivero/593fc51f1208555112e0
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
@cartermp
cartermp / test.md
Last active November 6, 2015 22:11
XML To Markdown testing

WuTang4Eva

Extensions

Provides extension methods for semantic string support.


IsNullOrWhiteSpace(System.String)
@cartermp
cartermp / LocationAwareBasic.java
Last active August 29, 2015 14:07
Contains basic functionality for retrieving a location in latitude and longitude.
/*
* This class explicitly implements the ConnectionCallbacks and
* OnCorrectionFailedListener interfaces. What this means is that
* this class will implement what happens when a connection to
* Google Play Services fails, and what happens when a connection
* succeeds.
*/
public class MainActivity extends FragmentActivity implements
GooglePlayServicesClient.ConnectionCallbacks,
GooglePlayServicesClient.OnConnectionFailedListener {
@cartermp
cartermp / piglatin.clj
Last active August 29, 2015 14:07
Beginning to learn Clojure
; Aliasing the string class to be more terse
(require '[clojure.string :as str])
; As a 'def', this is evaluated once
(def vowel? (set "AaEeOoIiUu"))
; Given a word, converts it into a pig latin equivalent
(defn convert-word [word]
(let [first-letter (first word)]
(if (vowel? first-letter)
@cartermp
cartermp / babbies.kt
Last active August 29, 2015 14:07
BabbiesFirstKotlin - JVM just got more fun
fun innerExpr(item: Int, mean: Int): Int {
return (item - mean) * (item - mean)
}
fun stdDev(items: List<Int>): Double {
val mean = items.sum() / items.size
val variance = items.map { innerExpr(it, mean) }.sum() / items.size
return Math.sqrt(variance.toDouble())
}