Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?
My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.
There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.
That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.
Let's look at some of the dimensions that make a difference and what I think of Clojure for them:
Thanks to /u/zpoo32 for reporting several issues in this list!
(require '[clojure.core.match :refer [match]] | |
'[clojure.string :as str] | |
'[hiccup2.core :refer [html]] | |
'[org.httpkit.server :as server]) | |
(defn router [req] | |
(let [paths (vec (rest (str/split (:uri req) #"/")))] | |
(match [(:request-method req) paths] | |
[:get ["users" id]] {:body (str (html [:div id]))} | |
:else {:body (str (html [:html "Welcome!"]))}))) |