(require 'mmm-mode)#name {
float: center;| def confirm_intent(prompt, answer) | |
| puts prompt | |
| users_answer = Capistrano::CLI.ui.ask("(type #{answer} to continue)? ") { |p| p.echo == true } | |
| abort unless users_answer == answer | |
| end | |
| task :staging do | |
| confirm_intent("Are you SURE you want to deploy to the staging server? ", "YES") | |
| role :app, "1.2.3.4" | |
| role :web, "1.2.3.4" |
| module ActiveRecord::Associations::ClassMethods | |
| %w{has_and_belongs_to_many has_many has_one}.each do |meth| | |
| eval(<<METHOD_OVERRIDE | |
| # intercepting the #{meth} method to add the :as_component option | |
| def #{meth}_with_component(name, options = {}) | |
| if options.delete(:as_component) | |
| options[:after_add] = :tell_my_parents | |
| self.components ||= [] | |
| self.components << name | |
| end |
| (defn del-sec | |
| "Delete a line or section from the lst. Optional second argument | |
| will force single line deletion rather than deleting an entire | |
| section." | |
| ([lst] | |
| (let [start (rand-int (.size lst)) | |
| length (rand-int (- (.size lst) start))] | |
| (concat (take start lst) (drop (+ start length) lst)))) | |
| ([lst single] | |
| (let [start (rand-int (.size lst))] |
| Exception in thread "main" Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'incanter:incanter-full:jar': Cannot find parent: incanter:incanter-parent for project: incanter:incanter-full:bundle:1.0-master-SNAPSHOT for project incanter:incanter-full:bundle:1.0-master-SNAPSHOT | |
| incanter:incanter-full:jar:1.0-master-SNAPSHOT |
| (add-to-list 'load-path "~/src/emacs-starter-kit/src/mmm-mode") | |
| (require 'mmm-mode) | |
| (setq mmm-global-mode 'maybe) | |
| (mmm-add-classes | |
| '((embedded-org-css | |
| :submode css | |
| :face mmm-declaration-submode-face | |
| :delimiter-mode nil | |
| :front "#\\+begin_src css" |
| #name : #+begin_...#+end_ | |
| # expand-env: ((yas/indent-line 'fixed) (yas/wrap-around-region 'nil)) | |
| # -- | |
| #+begin_$1 $2 | |
| $0 | |
| #+end_$1 |
| ;; how to use an imperative library (bcel) in clojure | |
| (defn list-expand [asm] | |
| ;; I need a mutable InstructionList | |
| (with-local-vars [lst (new InstructionList)] | |
| ;; Append is an InstructionList method on which alters the calling | |
| ;; InstructionList through side effects | |
| (map #(.append (var-get lst) %) asm) | |
| (var-get lst))) |
| (defun sinatra-web-server (&optional edit-cmd-args) | |
| "Run script/server. Dump output to a compilation buffer | |
| allowing jumping between errors and source code. With optional | |
| prefix argument allows editing of the server command arguments." | |
| (interactive "P") | |
| (let* ((script (buffer-file-name)) | |
| (command (if edit-cmd-args | |
| (read-string "Run Ruby: " (concat script " ")) | |
| script))) | |
| (ruby-compilation-run command))) |
| #!/usr/bin/env ruby | |
| ## reap long-running processes and all of their descendants | |
| ## | |
| ## (?_^ | |
| ## |\ ) | |
| ## |/_\ | |
| ## | |
| def variants | |
| %x{ps auxwww |grep -i "tmp/variant"}.split("\n").map{|l| $1 if l.match(/^[\S]+[\s]+([\d]+)[\s]+/)}.compact | |
| end |