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 / 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())
}
@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 / 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 / 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 / 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 / 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 / pipe-forward.scm
Created December 25, 2014 00:13
F# pipe-forward operator implemented in Scheme with a quick test
(define (|> f g)
(g f))
(define (square x)
(* x x))
(|> '(1 2 3 4 5) (lambda (x) (map square x)))
@cartermp
cartermp / CodeReviewChecklist.md
Last active October 19, 2018 15:11
CASS Code Review Checklist

General Non-Code

  • Does the application compile?
  • Does the application, with changes, run without crashing?
  • Can a database, if applicable, be deployed without error?
  • If a new feature is under review, does the new feature act as expected (if this is easy to test)?
  • Does the commit message indicate the scope of the change set?
  • Does the commit message call out any future work that remains to be done?
  • Does the scope of the change set appear to fulfill the given task, and only that task?
  • Is the change set associated with its appropriate work item?
@cartermp
cartermp / core.clj
Created April 12, 2015 00:26
Google Translate changes to core
(ns app.core
(:require
[app.cache :refer :all]
[clojure.string :as str]
[clojure.xml :as xml]
[clj-xpath.core :as xpath]
[ring.util.codec :as codec])
(:import (org.apache.tika.language.translate GoogleTranslator)))
(def langs {:en "english"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YES
{
public abstract class ErrorReportingBase
{