(ns foobar.search | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [cljs.core.async :refer [<! chan put!] :as a] | |
[reagent.core :as reagent] | |
[reagent.ratom :refer [atom]])) | |
; Source: https://gist.github.com/Deraen/946ac9e6c6211c83f1e9 | |
(defn debounce [in ms] | |
"Creates a channel which will change put a new value to the output channel |
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
-
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the
secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection. -
Use production SSL certificates locally. This is annoying
I. Create a Middleman project with middleman-ember-template
$ middleman init hello --template=ember
II. Install ember.js package
$ bower install ember
# Ruby `retry` with steroids: | |
# | |
# - retry up to 5 times without waiting between them and retrying after any exception | |
# | |
# retry_upto(5) do ... end | |
# | |
# - retry up to 5 times, waiting 2 seconds between retries | |
# | |
# retry_upto(5, :wait => 2) do ... end | |
# |
# [Tue Jun 21 12:05:39 2011] Protocol: http, Server: 192.168.5.103:9200 | |
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d ' | |
{ | |
"mappings" : { | |
"contact" : { | |
"properties" : { | |
"twitter" : { | |
"type" : "object", | |
"properties" : { | |
"profile" : { |
#make a new branch that tracks remote branche | |
git branch --set-upstream foo upstream/foo | |
#list the files modified on the last 10 commits and filter only spec files | |
git diff --name-only HEAD~10 | egrep _spec\.rb | |
#difference between the state of the file from 3 commits in the past | |
git diff HEAD~3 -- app/views/topics/merges/_new.html.haml | |
#run specs modified on the last 10 commits |
<a href="http://en.wikipedia.org/wiki/Lsof">lsof</a> | |
---- | |
show open files | |
lsof -nPp <pid> | |
<a href="http://linux.die.net/man/1/strace">strace</a> | |
------ |
With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)
Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
Processing by HomeController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
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: |