Skip to content

Instantly share code, notes, and snippets.

@kch
kch / Info.plist
Created August 19, 2010 04:50
n00b attempt at standalone foundation tool OS X service in MacRuby
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>upcase</string>
<key>CFBundleIdentifier</key> <string>com.caiochassot.services.upcase</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundlePackageType</key> <string>BNDL</string>
@maccman
maccman / widget.rb
Created October 19, 2010 09:48
MacRuby Webkit Interface
framework "WebKit"
class Widget
class RPC
class << self
public :include
end
def initialize(widget)
@widget = widget
@mattbaker
mattbaker / README
Created December 22, 2011 06:02
SVG to PNG render with Node and D3.js
This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js.
Run with node pie_serv.js
@segphault
segphault / spottest.rb
Created February 4, 2012 23:50
Querying spotlight with MacRuby
def performSearch(pred, &cb)
search = NSMetadataQuery.alloc.init
search.predicate = pred
search.searchScopes = [File.expand_path("~")]
NSNotificationCenter.defaultCenter.addObserverForName(
"NSMetadataQueryDidFinishGatheringNotification", object:nil, queue:nil,
usingBlock: Proc.new {|n| n.object.results.each {|r| cb.call(r) } })
search.startQuery
@actsasgeek
actsasgeek / osx.clj
Created May 17, 2012 17:10
A thin Clojure wrapper for com.apple.eawt.Application(Listener)
(ns osx
(:use seesaw.core)
(:import
[com.apple.eawt Application ApplicationListener]
[java.awt.image BufferedImage]))
;; mostly for use with Seesaw
;; https://github.com/daveray/seesaw
(defn event-not-handled [e] (.setHandled e false))
@pere
pere / datapublishers.json
Created June 28, 2012 17:10
Geographic d3.js bubbles
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stuartsierra
stuartsierra / spellcheck.clj
Created July 9, 2013 01:47
Example implementation of Norvig's Spellchecker in Clojure, using core.async
;; Example implementation of Norvig's Spellchecker in Clojure,
;; using core.async
;;
;; There are probably some bugs in this.
;;
;; Original problem: https://github.com/ericnormand/spelling-jam
;; from Lambda Jam, Chicago, 2013: http://lambdajam.com/
;;
;; Clojure core.async introduction:
;; http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html
@gizmaa
gizmaa / Plot_Examples.md
Last active June 10, 2024 02:44
Various Julia plotting examples using PyPlot
@bhauman
bhauman / core.cljs
Last active August 16, 2022 12:08
Helpful patterns when developing with ClojureScript Figwheel and Express js
(ns todo-server.core
(:require
[cljs.nodejs :as nodejs]
[figwheel.client :as fw]))
(nodejs/enable-util-print!)
(defonce express (nodejs/require "express"))
(defonce serve-static (nodejs/require "serve-static"))
(defonce http (nodejs/require "http"))
(ns background
(:require [clojure.tools.logging :as log])
(:import [java.util.concurrent]))
(defonce !executor (delay (java.util.concurrent.Executors/newCachedThreadPool)))
(defn background
"Calls the fn passed in a thread from a thread pool, returning immediately.
Unlike future, background does not swallow exceptions."
[f]