Skip to content

Instantly share code, notes, and snippets.

Justin Thomas base698

  • VDMS
  • Santa Monica, CA
Block or report user

Report or block base698

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MyFirstVerticle.java
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;
@base698
base698 / update-in.md
Last active Mar 11, 2016
update-in, get-in, and assoc-in
View update-in.md

update-in, assoc-in, get-in: Not using these functions is doing it wrong

I recently went back and looked at some clojure I wrote when I was learning.

Given:

(def x {:a 1 
        :b {:c 3}})
@base698
base698 / update-in.md
Created Mar 11, 2016
update-in, get-in, and assoc-in
View update-in.md

Not using these functions is doing it wrong.

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:

View gist:b8a7936f9935759e3659
function reverse(string) {
if(string.length == 1) {
return string;
}
return string.charAt(string.length - 1) + reverse(string.slice(0, string.length - 1));
}
View Work-queue.clj
(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)]
View gist:3a6c1961f7316feed412
import org.jibble.pircbot.*;
// http://www.jibble.org/pircbot.php
class GroovyBot extends PircBot {
def users = ["base698"];
public GroovyBot() {
this.setName("GroovyBot");
}
View http.sh
#!/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 }));
View express forms
npm install express
# server.js
var app = require('express')();
app.post('/myform', function(req, res) {
var formData = req.body;
console.log(formData);
})
@base698
base698 / stats.sh
Last active Aug 12, 2016
Find commits in a workspace for listed languages
View stats.sh
#!/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])
}
@base698
base698 / gist:5715612
Last active Dec 18, 2015
Something like this....
View gist:5715612
<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++){
You can’t perform that action at this time.