This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns logic.y | |
(:refer-clojure :exclude [== reify inc]) | |
(:use [clojure.core.logic minikanren prelude nonrel match])) | |
(defna findo [x l o] | |
([_ [[?y '- o] . ?r] _] (project [x ?y] (== (= x ?y) true))) | |
([_ [_ . ?c] _] (findo x ?c o))) | |
(defn typedo [c x t] | |
(conda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'magic_xml' | |
require 'trollop' | |
require 'open-uri' | |
require 'forkoff' | |
# Installation: | |
# | |
# gem install magic_xml trollop forkoff | |
# | |
# Get your delicious bookmark backup with: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
configure do | |
set :data, "none" | |
end | |
before do | |
content_type 'text/plain', :charset => 'utf-8' | |
request.env['PATH_INFO'].gsub!(/\/$/,'') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debug_line(*list) | |
ret = "Debug: " | |
0.step(list.length - 2, 2) do |x| | |
label, value = list[x,x+2] | |
ret += "#{label} = '#{value}', " | |
end | |
puts ret | |
end | |
debug_line("a", 10, "b", 20) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# backup your delicious bookmarks | |
curl -k --user `cat password.txt` -o backup.xml -O 'https://api.del.icio.us/v1/posts/all' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jruby.embed.PathType; | |
import org.jruby.embed.ScriptingContainer; | |
public class Embedder { | |
public ScriptingContainer container; | |
public String file; | |
public Embedder(String filename) { | |
file = filename; | |
container = new ScriptingContainer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package play; | |
import org.jruby.embed.PathType; | |
import org.jruby.embed.ScriptingContainer; | |
public class ClassUseSample { | |
public ScriptingContainer container; | |
public String file; | |
public ClassUseSample(String filename) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instant.rake | |
# Rake rules for compiling and running trivial Java programs | |
# | |
# Usage: rake com.example.MonkeyShines | |
# Source goes under ./src | |
# Classes end up under ./target | |
require 'rake/clean' | |
libs = FileList["lib/*"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Edits | |
def deletes1 | |
map_transforms do |word, i| | |
word.delete_at(i) | |
end | |
end | |
def transposes | |
map_transforms do |word, i| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "local" methods are those defined directly on a constant, | |
# as opposed to those inherited or mixed in | |
class Module | |
def local_class_methods | |
self.methods.select { |m| self.method(m).owner == self } | |
end | |
def local_instance_methods | |
self.instance_methods.select { |m| self.instance_method(m).owner == self } |
NewerOlder