Starting from:
lein new foo
cd foo
Say I have a random JAR file that is not available in any repository:
touch README.md
| For each Ruby module/class, we have Ruby methods on the left and the equivalent | |
| Clojure functions and/or relevant notes are on the right. | |
| For clojure functions, symbols indicate existing method definitions, in the | |
| clojure namespace if none is explicitly given. clojure.contrib.*/* functions can | |
| be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master, | |
| ruby-to-clojure.*/* functions can be obtained from the source files in this | |
| gist. | |
| If no method symbol is given, we use the following notation: |
| ; STM history stress-test | |
| (defn stress [hmin hmax] | |
| (let [r (ref 0 :min-history hmin :max-history hmax) | |
| slow-tries (atom 0)] | |
| (future | |
| (dosync | |
| (swap! slow-tries inc) | |
| (Thread/sleep 200) | |
| @r) |
| # Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences. | |
| # Instructions: | |
| # Go to TextMate > Preferences... | |
| # Click Advanced | |
| # Select Folder References | |
| # Replace the following: | |
| # File Pattern |
| set :test_log, "logs/capistrano.test.log" | |
| namespace :deploy do | |
| before 'deploy:update_code' do | |
| puts "--> Running tests, please wait ..." | |
| unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null' | |
| puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong." | |
| exit | |
| else | |
| puts "--> Tests passed" |
| require File.join(File.dirname(__FILE__), 'deploy/nginx') | |
| require File.join(File.dirname(__FILE__), 'deploy/log') | |
| default_run_options[:pty] = true | |
| set :ssh_options, { :forward_agent => true } | |
| set :application, "appname" | |
| set :repository, "git@giturl" | |
| set :scm, :git |
| // Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
| // Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
| var FORMAT_ONELINE = 'One-line'; | |
| var FORMAT_MULTILINE = 'Multi-line'; | |
| var FORMAT_PRETTY = 'Pretty'; | |
| var LANGUAGE_JS = 'JavaScript'; | |
| var LANGUAGE_PYTHON = 'Python'; |
| ;; Datomic example code | |
| (use '[datomic.api :only (db q) :as d]) | |
| ;; ?answer binds a scalar | |
| (q '[:find ?answer :in ?answer] | |
| 42) | |
| ;; of course you can bind more than one of anything | |
| (q '[:find ?last ?first :in ?last ?first] | |
| "Doe" "John") |
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
Sea:
var a = [];Dice la especificación de Javascript que los Arrays son simplemente unos objetos un poco curiosos y más o menos simpáticos. Tienen una propiedad especial llamada length y si le intentamos añadir una propiedad con un nombre que sea un número válido (uint32) entonces lo consideran un "índice" y tratan ese valor como un elemento de un array/vector/llámaloX que mantiene internamente.
La propiedad length es especial porque se actualiza más allá de nuestro control cuando ocurren algunas cosas. En concreto lo que dice la especificación es son las siguientes 2 cosas: Cada vez que se añada al array un elemento, es decir, cito (énfasis mío): "una propiedad cuyo nombre es un índice válido de array, si es necesario, length se actualizará a ser 1 más que ese índice". Además, cuando se modifique length, para mantener la restricción, "cualquier propiedad cuyo nombre es un índice válido que no es menor que el nuevo length, se borra automáticamente".