Skip to content

Instantly share code, notes, and snippets.

View ignacy's full-sized avatar
🦆
duck typing

Ignacy Moryc ignacy

🦆
duck typing
View GitHub Profile
(defun html (x)
"Return valid HTML code constructed from passed list"
(if (not (listp x))
x
(let ((tag (car x))
(body (cdr x)))
(if (and (listp (car body)) (string= "attributes" (first (car body))))
(concat "<" tag " " (car (cdr (car body))) ">"
(apply 'concat (mapcar 'html (cdr body)))
"</" tag ">")
(html '("html"
("head"
("body"
("div"
("h1" "Hello world")
("div" "I don't" ("b" " like ") "plain html page look")
("br")
("div" ("attributes" "class=span9 style=\"color:red\"")
"This is a webpage served by elnode!"))))))
(defun welcome-page-handler (httpcon)
(elnode-http-start httpcon "200" '("Content-type" . "text/html"))
(elnode-http-return httpcon (my-main-page)))
(defun html (x)
"Return valid HTML code constructed from passed list"
(if (not (listp x))
x
(let ((tag (car x))
(body (cdr x)))
(defun get-candidate-by-email (email)
(comint-send-string (inf-ruby-proc)
(format "candidate = User.find_by_email('%s').try(:profile)" email)))
(defun get-your-candidate ()
(interactive)
(get-candidate-by-email "someemail@gmail.com"))
(ns word_wrap_cata_clojure.test.core
(:use [word_wrap_cata_clojure.core])
(:use [midje.sweet])
(:use clojure.pprint))
;; Source: http://blog.8thlight.com/uncle-bob/2013/01/07/FPBE3-Do-the-rules-change.html
(facts
(defun run-file-or-spec ()
"If we're in a spec file - run rspec; in other case use quickrun"
(interactive)
(let ((file-name-ending (substring (file-name-nondirectory (buffer-file-name)) -8 nil)))
(if (string= "_spec.rb" file-name-ending)
(rspec-verify)
(quickrun))))
(bind "<f14>" 'run-file-or-spec)
(defadvice find-tag-at-point (before auto-visti-tags)
"Load default TAGS file from home directory if needed"
(visit-tags-table (concat (projectile-project-root) "TAGS")))
(ad-activate 'find-tag-at-point)
(defun sublime-text-2 ()
(interactive)
(color-theme-install
'(sublime-text-2
((background-color . "#171717")
(background-mode . light)
(border-color . "#1a1a1a")
(cursor-color . "#fce94f")
(foreground-color . "#cfbfad")
(mouse-color . "black"))
#/bin/bash
# stolen from http://kingstonlabs.co.uk/blog/how-to-install-solr-36-on-ubuntu-1204/
sudo apt-get update; sudo apt-get upgrade -y;
# Install solr and jetty packages
sudo apt-get install jetty openjdk-7-jdk libjetty-extra unzip -y
cd ~;
wget http://www.eng.lsu.edu/mirrors/apache/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
tar -xvzf *.tgz;
rm *.tgz;
@ignacy
ignacy / pr.md
Created May 13, 2013 08:45 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: