This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
| #### | |
| # Description:a ruby script to monitor metaq queue size | |
| # Requirements: zookeeper | |
| # sudo gem install zookeeper | |
| # | |
| ##### | |
| require 'rubygems' | |
| require 'zookeeper' | |
| require 'socket' |
| #!/bin/ruby | |
| if __FILE__ == $0 | |
| vars = {} | |
| Dir.glob("**/*") do |name| | |
| if File.file? name and name =~ /\.clj$/ | |
| File.open(name,"r") do |f| | |
| content = f.read | |
| if content =~ /environ.core/ | |
| content.scan(/\(env :([a-zA-Z\-]+) ("([^\)]+)")?\)/).each do |matches| |
| (ns cache.lru | |
| (:use [clojure.core.cache :only [CacheProtocol defcache]])) | |
| (defn- build-leastness-queue | |
| [base limit start-at] | |
| (merge | |
| (into {} (take (- limit (count base)) (for [k (range (- limit) 0)] [k k]))) | |
| (into {} (for [[k _] base] [k start-at])))) | |
| (defcache LRUCache [cache lru tick limit evict-handler] |
| #!/usr/bin/ruby | |
| ## Author : dennis (killme2008@gmail.com) | |
| ## Description : A ruby script to generate docset for dash from your public gists.Test on ruby-2.0.0-p0. | |
| ## Dependencies : sudo gem install sqlite3 | |
| ## Useage : Type command : ruby gen_docset_for_dash.rb [docset_name] [github_account] | |
| ## Then it will create a folder named '[docset_name].docset' in current folder,you can add the generated | |
| ## docset to dash in dash Preferences menu. | |
| require 'rubygems' | |
| require 'fileutils' |
| var fs = require('fs'); | |
| var file = __dirname + '/test.json'; | |
| fs.readFile(file, 'utf8', function (err, data) { | |
| if (err) { | |
| console.log('Error: ' + err); | |
| return; | |
| } | |
| data = JSON.parse(data); |
| ;;Code for https://www.jinshuju.net/f/EGQL3D | |
| (defn- read-n-numbers [n] | |
| (repeatedly n #(let [x (read-line)] | |
| (Integer/valueOf x)))) | |
| (defn- say-what [inputs words n] | |
| (let [[x y z] inputs | |
| rs (filter #(zero? (rem n %)) inputs)] | |
| (cond | |
| ;;rule 5 |
| /* ******************************************* | |
| // LICENSE INFORMATION | |
| // The code, "Detecting Smartphones Using PHP" | |
| // by Anthony Hand, is licensed under a Creative Commons | |
| // Attribution 3.0 United States License. | |
| // | |
| // Updated 01 March 2010 by Bryan J Swift | |
| // - Remove un-needed if statements instead just returning the boolean | |
| // inside the if clause | |
| // |
| /* ******************************************* | |
| // LICENSE INFORMATION | |
| // The code, "Detecting Smartphones Using PHP" | |
| // by Anthony Hand, is licensed under a Creative Commons | |
| // Attribution 3.0 United States License. | |
| // | |
| // Updated 01 March 2010 by Bryan J Swift | |
| // - Remove un-needed if statements instead just returning the boolean | |
| // inside the if clause | |
| // |
| (ns fizz-buzz | |
| "《计算的本质》第 6 章使用 clojure 基于 lambda 演算实现 FizzBuzz 程序。") | |
| (def zero (fn [p] (fn [x] x))) | |
| (def one (fn [p] (fn [x] (p x)))) | |
| (def two (fn [p] (fn [x] (p (p x))))) | |
| (def three (fn [p] (fn [x] (p (p (p x)))))) | |
| (def four (fn [p] (fn [x] (p (p (p (p x))))))) | |
| (def five (fn [p] (fn [x] (p (p (p (p (p x)))))))) |