Skip to content

Instantly share code, notes, and snippets.

View JackDanger's full-sized avatar

Jack Danger JackDanger

View GitHub Profile
@JackDanger
JackDanger / gist:6232426
Created August 14, 2013 15:56
error installing Revel go web framework
# If you see this:
$ go get github.com/robfig/revel
package code.google.com/p/go.net/websocket
imports github.com/robfig/pathtree
imports github.com/streadway/simpleuuid
imports net/http/cookiejar: unrecognized import path "net/http/cookiejar"
# You need to upgrade to go version 1.1
@JackDanger
JackDanger / gist:5592942
Created May 16, 2013 16:14
Compiling JRuby on Java 1.8?
# If you get the following, the solution is to try compiling under Java 1.6
# $ JAVA_HOME=`/usr/libexec/java_home -v 1.6` rvm install jruby-head
compile-jruby:
[javac] Compiling 1395 source files to /Users/jackdanger/.rvm/src/jruby-head/build/classes/jruby
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[javac] /Users/jackdanger/.rvm/src/jruby-head/src/org/jruby/javasupport/JavaClass.java:1418: error: cannot find symbol
[javac] return getRuntime().newBoolean(javaClass().isAnnotationPresent(((JavaClass)annoClass).javaClass()));
[javac] ^
[javac] symbol: method isAnnotationPresent(Class)
def odd(list)
list.each_with_index do |item, index|
yield item if index % 2 == 0
end
end
def even(list)
list.each_with_index do |item, index|
yield item if index % 2 == 1
end
projects=`locate Gemfile.lock | egrep -v "(.rvm|bundler|.passenger)" | xargs egrep " rails" | cut -d : -f 1 | uniq | xargs egrep -L 'rails \((2.3.15|3.0.19|3.1.10|3.2.11)\)' |cut -d : -f 1 | xargs -n 1 dirname`
for project in $projects; do
echo '-----------------'
echo '-- PATCHING' $project ' -- '
echo '-----------------'
cd $project
git stash
git checkout master
git pull
sed -i .bak "s/gem [\"|']rails[\"|'], [\"|']2.*[\"|']/gem 'rails', '2.3.15'/g" Gemfile
printf("%c\n", 14)
printf("%c ", 0x6A) # ┘
printf("%c ", 0x6B) # ┐
printf("%c ", 0x6C) # ┌
printf("%c ", 0x6D) # └
printf("%c ", 0x6E) # ┼
printf("%c ", 0x71) # ─
printf("%c ", 0x74) # ├
printf("%c ", 0x75) # ┤
printf("%c ", 0x76) # ┴
@JackDanger
JackDanger / mi-5.script
Created July 27, 2012 03:54
MI-5 has the worst technobabble ever.
Actual dialogue between two characters in MI-5 Volume 9 Episode 1
Boss: You crack the code?
"Techie": Not exactly. Each message between Habib and Talwar has a different dynamic signature.
I have to trawl the non-indexed deep web to construct a cipher. It requires a lot of
computing power; takes time.
Boss: And you're waiting for...?
(ns crawler.crawler
(:gen-class)
(:require [net.cgrand.enlive-html :as html]
org.bovinegenius.exploding-fish))
(def crawled (atom #{}))
(defn fetch
"Retrieve contents of a page at a given url"
(ns palindrome
(:use clojure.test))
(with-test
(defn is-palindrome?
"is true if the given argument is a palindrome"
[string]
(loop [string string]
(cond
(= \space (first string))
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><meta http-equiv="refresh" content="0;url=/wordpress/" /></head><body></body></html>