There are many articles and discussion threads on the web regarding the nature of Object-oriented (OO) programming. Most of them come at the question from a Programming Language Theory (PLT) perspective, attempting to assert a formal definition of OO programming and objects. I'm not going to do that here. Instead, I'm going to write about objects from an implementation perspective, approaching the subject first from below and then from above.
(ns starlab.services.nashorn | |
(:require [clojure.tools.logging :as log] | |
[clojure.java.io :as io]) | |
(:import [javax.script | |
Invocable | |
ScriptEngineManager]) | |
(:use [plumbing.core :exclude [update]])) | |
(defn nashorn-env [] | |
(doto (.getEngineByName (ScriptEngineManager.) "nashorn") |
(page "index.html" | |
(:require | |
[tailrecursion.hoplon.reload :refer [reload-all]])) | |
(reload-all 0) | |
(defn random-minefield [size n] | |
(loop [mines #{}] | |
(if (< (count mines) n) | |
(recur (conj mines [(rand-int size) (rand-int size)])) |
(deftask start [] | |
(let [f (delay (do | |
(require 'fy.core) ;; cljx file | |
((resolve 'fy.core/start-system!))))] | |
(with-post-wrap fileset @f fileset))) |
(ns example.macros | |
(:require | |
[cljs.analyzer :as a] | |
[cljs.compiler :as c])) | |
(defmacro complies? | |
"True if x satisfies and implements all methods of a protocol. | |
Ex. |
(defn keys->strings | |
"Given a map converts all keys that are keywords from dash-separated to | |
camel-case using key->string." | |
[m] | |
(let [f (fn [[k v]] [(key->string k) v]) | |
walk-fn (fn [x] | |
(if (map? x) | |
(->> (map f x) | |
(into {})) | |
x))] |
Last week Dropbox introduced Dropbox Pro with 1TB storage space (and some other cool features) for $99/year (or $9,99/month), which is a pretty good deal (Google Drive 1TB also costs $99,99/year). The problem: it's not $99/year, but $130/year (or $13/month) if you happen to live in Europe. Instead of converting prices from dollars to euros, they just changed $ to €.
But that's not the best part. You can buy it cheaper if you use Dropbox app on iOS.
Now it's only $118/year or $10/month, which is much cheaper than through their website (and they still have to give 30% of that to apple!). I guess we should thank apple for not allowing different pricing in different regions. So if you plan to upgrade to Dropbox Pro, do it through their mobile app.
(ns racehub.om.facebook | |
(:require [cljs.core.async :as a] | |
[racehub.schema :as rs] | |
[schema.core :as s :include-macros true])) | |
;; ## Utilities | |
(defn prune | |
"Takes a mapping of keys -> new key names and a map and returns a | |
map with nils removed and keys swapped where they're present in the |
(require '[clojure.java.io :as io]) | |
(deftask demo [] | |
(let [tmp (tmp-dir!) ; Anonymous, boot-managed temp directory. | |
prev-fs (atom nil)] ; Atom where the previous fileset is stored. | |
(with-pre-wrap [fs] | |
(let [diff (fileset-diff @prev-fs (reset! prev-fs fs)) ; Fileset containing only changed files. | |
inputs (->> (input-files diff) ; Sequence of [String, java.io.File] | |
(by-ext [".c"]) ; pairs, the classpath path and File | |
(map (juxt tmp-path tmp-file)))] ; for files with given extensions. |
app.filter('bytes', function() { | |
return function(bytes, precision) { | |
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-'; | |
if (typeof precision === 'undefined') precision = 1; | |
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB']; | |
var number = Math.floor(Math.log(bytes) / Math.log(1024)); | |
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; | |
}; | |
}); |