Skip to content

Instantly share code, notes, and snippets.

View mowen's full-sized avatar

Martin Owen mowen

View GitHub Profile
(eval-after-load 'org
'(progn
(set-face-foreground 'org-level-2 "magenta4")
(set-face-foreground 'outline-2 "magenta4")
(set-face-foreground 'org-level-6 "red3")
(set-face-foreground 'outline-6 "red3")))
;; A palindromic number reads the same both ways. The largest palindrome made
;; from the product of two 2-digit numbers is 9009 = 91 × 99.
;;
;; Find the largest palindrome made from the product of two 3-digit numbers.
;;
(defun array-reverse (array)
"Reverse the ARRAY."
(let ((reversed-array (copy-sequence array))
(array-length (length array))
/**
* SiteFocus, an enhanced version of the Blacklist Sites - Page Mods Demo.
* Recommended for anyone who has this problem: http://xkcd.com/477/
* Martin Owen - martinowenuk@gmail.com
*/
jetpack.future.import("storage.simple");
jetpack.future.import('menu');
function SiteFocus() {
(ns martin)
(defn sqr
"Square the given number."
[n]
(. (BigInteger/valueOf n) (pow 2)))
(defn euler-6
"Find the difference between the sum of the squares of the first one hundred
natural numbers and the square of the sum."
(ns martin)
(defn evenly-divisible?
"Is N evenly-divisible by all of the numbers in SEQ?"
[n seq]
(loop [s seq]
;; TODO: Find out how to do 'cond' in Clojure
(if (empty? s)
true
(if (not (zero? (mod n (first s))))
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Experiments
{
public class BadService : IService
{
public string ProvideService()
// Method for converting a Json.NET object into a dynamic CLR object.
// http://groups.google.com/group/mongodb-csharp/browse_thread/thread/ef1308f38bdbde3e
public static class DynamicUtils
{
public static object ConvertJTokenToObject(JToken token)
{
if (token is JValue)
{
return ((JValue)token).Value;
}
(defvar mo-script-url-alist
'((jquery . "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js")
(json2 . "http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js")
(ocanvas . "http://cdnjs.cloudflare.com/ajax/libs/ocanvas/1.0/ocanvas.min.js")
(processing . "http://cdnjs.cloudflare.com/ajax/libs/processing.js/1.2.1/processing-api.min.js")
(prototype . "https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js")
(sizzle . "http://cdnjs.cloudflare.com/ajax/libs/sizzle/1.4.4/sizzle.min.js")
(underscore . "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.1.7/underscore-min.js")
(underscore-string . "http://cdnjs.cloudflare.com/ajax/libs/underscore.string/1.1.4/underscore.string.min.js")
(waypoints . "http://cdnjs.cloudflare.com/ajax/libs/waypoints/1.1/waypoints.min.js"))
@mowen
mowen / index.html
Created September 3, 2011 22:14
Control a tank in HTML5 Canvas
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Chapter 4 Example 9: Animating an image with rotation</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.1.7/underscore-min.js"></script>
<script src="ex9.js"></script>
</head>
<body>