THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
| " Zip Right | |
| " | |
| " Moves the character under the cursor to the end of the line. Handy when you | |
| " have something like: | |
| " | |
| " foo | |
| " | |
| " And you want to wrap it in a method call, so you type: | |
| " | |
| " println()foo |
| ;; Updated tutorial code for Om 0.1.6, 2014-01-16 | |
| ;; http://www.lexicallyscoped.com/2013/12/25/slice-of-reactjs-and-cljs.html | |
| ;; See comments below for details on the changes. | |
| (def app-state | |
| (atom {:comments [{:author "Pete Hunt" :text "This is a comment."} | |
| {:author "Jordan Walke" :text "This is *another* coment"}]})) | |
| (defn comment [{:keys [author text]} owner] | |
| (om/component |
| # Bind SSL port with PFS-enabling cipher suite | |
| bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:!MD5:!aNULL:!DH:!RC4 | |
| # Distinguish between secure and insecure requests | |
| acl secure dst_port eq 443 | |
| # Mark all cookies as secure if sent over SSL | |
| rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure | |
| # Add the HSTS header with a 1 year max-age |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
| (def map-state { :layers [{:selected true :title "Layer One"}, {:selected false :title "Layer Two" }]}) | |
| ; I want a way to write reusable components that take and update data from a cursor, | |
| ; where the parent decides how the data is calculated and updated. | |
| (defn checkbox [checked] | |
| (om/component | |
| (dom/input {:type "checkbox" :checked checked | |
| :onClick #(om/update! checked (not checked)}))) | |
| var str = '\n\n\n Multiline text\n with indentation\n damn.\n\n\n'; | |
| // remove first and last empty lines | |
| str = str.replace(/^[\r\n]+|[\n\r]+$/gi, ''); | |
| var indentTab = str.match(/\t*/) != '', | |
| indentSize = indentTab ? 1 : str.match(/\s*/)[0].length, | |
| regex = new RegExp('^(?:' + (indentTab ? '\\t' : ' {' + indentSize + '}') + ')', 'mg'); | |
| // Remove indent |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| function newOperator(Constr, args) { | |
| var inst = Object.create(Constr.prototype); | |
| var result = Constr.apply(inst, args); | |
| if (typeof result === 'object' && result !== null) { | |
| return result; | |
| } | |
| return inst; | |
| } |