Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@javazquez
javazquez / basicAuthEx.groovy
Created May 16, 2015 15:44
Basic Auth with Groovy
//Here is a quick groovy 1.7.4 Basic Auth Example
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0' )
def authSite = new groovyx.net.http.HTTPBuilder( 'http://10.110.201.115/~juanvazquez/basicAuth/' )
authSite.auth.basic 'test', 'this'
println authSite.get( path:'testAuth.html' )
@javazquez
javazquez / soundex.clj
Last active March 19, 2018 02:59
Clojure Soundex
;;Example of Clojure Soundex Code for my blog
;;http://javazquez.com/juan/2012/08/28/clojure-soundex/
(def val-map {"FBVP" 1,"CGJKQSXZ" 2,"DT" 3,"L" 4,"MN" 5,"R" 6, "AEIOU" "!" }))
(defn map-builder [alphas num]
(zipmap alphas (repeat num)))
(def conversion-map
(reduce merge (map #(map-builder (key %) (val % )) val-map) ))
@javazquez
javazquez / gapi.cljs
Last active December 3, 2017 17:45
Clojurescript Gmail API example ran with lumo. Converted Nodejs example from https://developers.google.com/gmail/api/quickstart/nodejs
;; Juan Vazquez
;; javazquez.com
;; https://github.com/javazquez
;; example converted from https://developers.google.com/gmail/api/quickstart/nodejs
(ns gmail-client.gapi
(:require [fs ]
[readline]
[googleapis :as google]
[google-auth-library :as googleAuth]
[goog.object]))
@javazquez
javazquez / clojure_instaparse_arnoldc_grammer.clj
Created February 18, 2017 03:02
clojure instaparse arnoldc grammer
Program = method-declaration* begin-main wspace method-declaration*;
begin-main = <'IT\'S SHOWTIME'> (statement wspace)* end-main ;<wspace> = <#'\s*'>;statement = wspace (assignment | printing | decvar | assign-var-from-method-call |
call-method | if | while | call-method | return);method-statement = (assignment | printing | decvar | assign-var-from-method-call |
call-method | if | while | call-method);call-method = <'DO IT NOW'> wspace method-name numvar* wspace;method-name = (number| #'[a-zA-Z][a-zA-Z0-9]*' |zero |false | true) assign-var-from-method-call = <'GET YOUR ASS TO MARS'> wspace variable wspace call-method;assignment = <'GET TO THE CHOPPER'> numvar wspace set-val wspace end-assignment wspace;
while= <'STICK AROUND'> numvar wspace statement* end-while ;
<end-while>= <'CHILL'>;
set-val= <'HERE IS MY INVITATION'> numvar (arithmetic-op|logical-op)*;
<end-assignment>= <'ENOUGH TALK'>;