Skip to content

Instantly share code, notes, and snippets.

View paddycakes's full-sized avatar

Patrick Gallagher paddycakes

  • London, England
View GitHub Profile
@paddycakes
paddycakes / gulpfile.js
Created December 2, 2014 15:24
Basic Gulp file with jshint configured
var gulp = require("gulp");
var jshint = require("gulp-jshint");
gulp.task("default", function () {
console.log("Hello Gulp");
return gulp.src("./js/**/*.js")
.pipe(jshint())
.pipe(jshint.reporter("default"));
});
@paddycakes
paddycakes / chapter1.scm
Last active December 30, 2015 07:39
Structure and Interpretation of Computer Programs (SICP) - Chapter 1 exercises and solutions in Scheme
;; Exercise 1.1. Below is a sequence of expressions. What is the result printed by the interpreter
;; in response to each expression? Assume that the sequence is to be evaluated in the order in which
;; it is presented.
10
;Value: 10
(+ 5 3 4)
;Value: 12
@paddycakes
paddycakes / NewGradleProject.groovy
Created December 1, 2013 01:03
A Groovy script to interactively create a Gradle project (Java, Groovy or Application as specified by user input) and directory structure. Also inits a Git repository for the project.
def GROOVY = "groovy"
def JAVA = "java"
def APPLICATION = "application"
def plugins = [GROOVY, JAVA, APPLICATION]
def projectName
def projectType
def console = System.console()
@paddycakes
paddycakes / weather.clj
Created December 1, 2013 00:51
Interrogate the openweathermap.org REST API using Clojure
;; http://openweathermap.org/API
;; Free, JSON api that provides current weather data and forecasts.
;; How many cities called London are there? (hint: find?q=London)
;; What are the lat/long positions of all the Londons?
;; What is the forecasted average temperature for London, UK for the last 5 days? (hint: forecast?q=London)
@paddycakes
paddycakes / poker.clj
Last active December 29, 2015 19:58
Score a poker hand using Clojure
;; This returns a list of 52 maps
(def deck
"Represents a deck of 52 poker cards."
(for [suit [:clubs :hearts :spades :diamonds]
pip (range 2 15)]
{:suit suit
:pip pip}))
(defn get-hand
"Return a poker hand of 5 cards."