This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (immutant.messaging.core/with-connection :host "somehost" :port 1234 (receive (.createQueue (immutant.messaging.core/session) "SomeQueue"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns consumer | |
| (:import [javax.jms Connection Message MessageConsumer Queue Session MessageListener TextMessage]) | |
| (:import [org.hornetq.api.core TransportConfiguration]) | |
| (:import [java.util HashMap Map]) | |
| (:import [org.hornetq.api.jms HornetQJMSClient JMSFactoryType]) | |
| (:import [org.hornetq.jms.client HornetQConnectionFactory])) | |
| (def props (java.util.HashMap. {"host" "somehost" "port" (Integer. 1234) "use-nio" true})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (use '[datomic.api :only [q db] :as d]) | |
| (def uri "datomic:mem://accounts") | |
| ;; create database | |
| (d/create-database uri) | |
| ;; connect to database | |
| (def conn (d/connect uri)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Memoization is fundamentally a top-down computation and dynamic | |
| programming is fundamentally bottom-up. In memoization, we observe | |
| that a computational *tree* can actually be represented as a | |
| computational *DAG* (the single most underrated data structure in | |
| computer science); we then use a black-box to turn the tree into a | |
| DAG. But it allows the top-down description of the problem to remain | |
| unchanged. | |
| In dynamic programming, we make the same observation, but construct | |
| the DAG from the bottom-up. That means we have to rewrite the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (use '[datomic.api :only (q db) :as d]) | |
| (def initial-data | |
| [{:sku "1" :price 0.95M :qty 1} | |
| {:sku "2" :price 1.99M :qty 0} | |
| {:sku "3" :price 1.99M :qty 0} | |
| {:sku "4" :price 5.99M :qty 3} | |
| {:sku "5" :price 9.99M :qty 2} | |
| {:sku "6" :price 2.99M :qty 3} | |
| {:sku "7" :price 2.99M :qty 2}]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| map \rs :RunSpec<cr> | |
| map \rsl :RunSpecLine<cr> | |
| map \t :CommandT<cr> | |
| set hidden | |
| let g:RspecBin="bundle exec rspec" | |
| inoremap <c-p> <esc>ka | |
| inoremap <c-n> <esc>ja | |
| inoremap <c-b> <esc>ha | |
| inoremap <c-f> <esc>la | |
| inoremap <c-a> <esc>0i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yaml' | |
| require 'httparty' | |
| settings = YAML::load_file(File.dirname(File.expand_path(__FILE__)) + '/namecheap.yml') | |
| username = settings['namecheap']['user'] | |
| api_key = settings['namecheap']['api_key'] | |
| request_string = "https://api.namecheap.com/xml.response" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://upstre.am/blog/2011/07/sublime-text-2-with-rvm-on-osx/ | |
| It's even easier as rvm already ships with a wrapper located in ~/.rvm/bin/rvm-auto-ruby. So you just need to edit the Ruby.sublime-build to this: | |
| { "cmd": ["~/.rvm/bin/rvm-auto-ruby", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.ruby"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'builder' | |
| builder = Builder::XmlMarkup.new | |
| xml = builder.transaction time: Time.now, merchant_code: 179001795 do |transaction| | |
| transaction.price '$27.50' | |
| transaction.billing do |billing| | |
| billing.name 'John Doe' | |
| billing.address1 '123 Any St' | |
| billing.country 'Mongolia' | |
| end |