Skip to content

Instantly share code, notes, and snippets.

@pjaspers
pjaspers / gist:ec31fc5c2cce175e9ae0
Created June 5, 2014 22:08
Let over lambda-ish
func counter() -> (() -> Int) {
var x = 0
func add() -> Int {
x += 1
return x
}
return add
}
var count = counter()
@pjaspers
pjaspers / .pryrc
Last active August 29, 2015 14:04
if defined?(Rails) && Rails.env
begin
require 'hirb'
Hirb.enable
old_print = Pry.config.print
Pry.config.print = proc do |*args|
Hirb::View.view_or_page_output(args[1]) || old_print.call(*args)
end
rescue LoadError
puts "No hirb"
# Helper functions to interact with the DB of [gifwit](http://gifwit.com)
function gifcount() {
COUNT=$(gifme | wc -l)
echo "Current number of gifs: ${COUNT}"
}
# Usage: `gifme cats`
function gifme() {
db="${HOME}/Library/Containers/stevesmith.gifwit/Data/Library/Application Support/stevesmith.gifwitfiles/gifwit.storedata"
query="select ZURL, ZKEYWORDS from ZIMAGE where ZKEYWORDS LIKE '%$1%';"
- SICP Distilled: Waiting for delivery
- Quickdraw Cable: Waiting for delivery
- SHRU - The intelligent cat companion: Waiting for delivery
- Obduction: Waiting for delivery
- The Vamp - Bring Back the Sound: Happy with it.
- Une Bobine - For People Who Love iPhone... and Android: Disappointing
- Make a Better CoffeeScript Compiler: Happy with it
- Light Table: Happy with it
- Pebble: E-Paper Watch for iPhone and Android: did what said it on the box. Happy with it.
- Make Leisure Suit Larry come again!: Not sure whatever happend to it.
@pjaspers
pjaspers / gist:0b43b792b71f2bab414c
Last active August 29, 2015 14:11
OpenHack eten.

We gaan hier bestellen: http://www.just-eat.be/restaurants-pizza-apetito-antwerpen/menu

Dus naam, bestelling, hoeveel dat kost en gepland tijdstip van aankomen toevoegen.

Bijv. Piet, pizza pepperoni, 5.60, 18u00.

Dan zullen wij dat bestellen en voorschieten.

(Er is ook een menu deel 3, waar we 3 medium pizza's kunnen bestellen voor 21)

(defun pjaspers-emoji-me()
"Takes a word and show in a temporary buffer all emoji matching that"
(interactive)
(let* ((wildcard-name (read-string "Enter string to look for: "))
(all-known (ucs-names))
(buffer-name (format "*emoji-me-%s*" wildcard-name))
(results (remove-if-not (lambda(x) (let ((str (car x)))(string-match wildcard-name str))) all-known)))
(with-output-to-temp-buffer buffer-name
(print (mapconcat (function (lambda(x) (format "%s - %s" (car x) (char-to-string (cdr x))))) results "\n"))
(switch-to-buffer buffer-name))))
@pjaspers
pjaspers / pjaspers-color-theme.el
Created December 26, 2014 14:40
The result of having applied several color themes, and somehow I kind of like it. Example: http://cl.ly/image/1f07132f2508
(eval-when-compile (require 'color-theme))
(defun pjaspers-color-theme ()
"Color theme by Piet Jaspers, created 2014-12-25."
(interactive)
(color-theme-install
'(my-color-theme
((background-color . "lightyellow2")
(background-mode . dark)
(border-color . "black")
(cursor-color . "black")
@pjaspers
pjaspers / gist:943df971f72896372287
Last active August 29, 2015 14:12
Trying to get a list-to-watch-to-get-to-know-Myasaki.
describe "Dixis" do
subject(:dixis) { SomeExpensiveDixisGenerator.new.take_long_time! }
it "behaves like a dixis" do
expect(dixis.name).to eq("dixis")
end
it "looks like a dixis" do
expect(dixis.beard).to eq(true)
@pjaspers
pjaspers / gifferis.markdown
Last active August 29, 2015 14:13
The @Inferis® collection of 2014

Yeah sure

Yeah sure

amazed

amazed

loss_for_words