I recently went back and looked at some clojure I wrote when I was learning.
Given:
(def x {:a 1 :b {:c 3}})
So for a case like this, where I wanted to increment {:c 3} and have the change persist in x I was doing code like this:
npm install express | |
# server.js | |
var app = require('express')(); | |
app.post('/myform', function(req, res) { | |
var formData = req.body; | |
console.log(formData); | |
}) |
#!/usr/local/bin/node | |
var express = require('express'); | |
var home = process.cwd(); | |
var ONE_DAY = Math.floor(315576000000/365); | |
var app = express(); | |
app.use( | |
express.static(home, { maxAge: ONE_DAY })); |
import org.jibble.pircbot.*; | |
// http://www.jibble.org/pircbot.php | |
class GroovyBot extends PircBot { | |
def users = ["base698"]; | |
public GroovyBot() { | |
this.setName("GroovyBot"); | |
} | |
<html> | |
<meta charset="utf-8"> | |
<head> | |
<SCRIPT LANGUAGE="JavaScript"> | |
function textProcess(form) { | |
var apiCalls= []; | |
var textInput = form.inputbox.value; | |
var inputArray=textInput.split(" "); | |
for (i=0; i<inputArray.length; i++){ |
function reverse(string) { | |
if(string.length == 1) { | |
return string; | |
} | |
return string.charAt(string.length - 1) + reverse(string.slice(0, string.length - 1)); | |
} |
(defn work-queue | |
" Work queue to process jobs with function f. Specify number of go threads " | |
([go-threads jobs f] (work-queue go-threads jobs f nil nil)) | |
([go-threads jobs f cb] (work-queue go-threads jobs f nil cb) ) | |
([go-threads jobs f notification-channel cb] | |
(let [work-queue (chan) | |
jobs-count (count jobs) | |
timeout-in-s 300 | |
job-queue (chan)] |
#!/bin/bash | |
source_reg='\b(scala|cpp|js|java|coffee|rb|java|clj|py|groovy|html|ejs|sh|cljs)\b'; | |
awk_counts='{ | |
counts[tolower($1)]++ | |
} | |
END { | |
for(type in counts) { | |
print(type, counts[type]) | |
} |
package io.vertx.blog.first; | |
import java.io.File; | |
import java.util.Scanner; | |
import io.vertx.core.AbstractVerticle; | |
import io.vertx.core.Future; | |
public class MyFirstVerticle extends AbstractVerticle { | |
static String data; | |
final static int BLOCK_SIZE = 250000; |