Skip to content

Instantly share code, notes, and snippets.

@josefbetancourt
josefbetancourt / FindFile.groovy
Created Jul 9, 2012
Use Groovy to find path of a file in a directory tree
View FindFile.groovy
import groovy.transform.TypeChecked
/**
* search file according to its name in directory and subdirectories
*/
@TypeChecked
class FileFind {
String basePath; // for unit testing
View DuplicatePropDetectWithCommonsConfig.java
package com.octodecillion.util;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
View HexDump.groovy
package com.octodecillion.util
import static java.lang.Character.*
/**
* Simple ASCII hex dump of file.
* <p>
* Example output:<br>
* <pre>
* OFFSET 0 1 2 3 4 5 6 7 8 9 a b c d e f | ASCII
@josefbetancourt
josefbetancourt / index.js
Last active Aug 12, 2016
Using Media Queries in React
View index.js
import React from 'react';
import {render} from 'react-dom';
import "babel-polyfill";
import invariant from "invariant";
/**
* A P P
*
*/
var App = React.createClass({
@josefbetancourt
josefbetancourt / Toggle.js
Last active Jan 20, 2016
RxJS example of reactive toggable and cancellable process loop in browser
View Toggle.js
// Toggle.js RxJS example of reactive toggable and cancellable process loop
// By: Josef Betancourt
// Date: Jan 11, 2016
// =========== Model
var counter = 1;
var runningState = true;
var msg = '';
var runButtonValue = 'Start';
View PruneDeletionTree.java
package com.octodecillion.learn.rxjava;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import rx.Observable;
/**
*
* @author jbetancourt
@josefbetancourt
josefbetancourt / HelloRxTest.java
Last active Jan 3, 2016
Hello world using RxJava.
View HelloRxTest.java
package com.octodecillion.learn.rxjava;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Before;
@josefbetancourt
josefbetancourt / INIX-example.inix
Last active Dec 29, 2015
Inix file reader source code to accompany blog post "Groovy implementation of INIX file format"
View INIX-example.inix
# Example very simple data file
#
[>root]
one
two
three
[<root]
[>demo1/compile]
x,y,z
[<demo1/compile]
@josefbetancourt
josefbetancourt / GoGenerator.groovy
Created Oct 15, 2013
Code for blog post "Change dir batch generator using Groovy" on http://octodecillion.com
View GoGenerator.groovy
/**
* GoGenerator.groovy
* Copyright 2010 Josef Betancourt 20100312-17:47
*/
/*@Grapes([
@Grab(group='ch.qos.logback', module='logback-core', version='0.9.18'),
@Grab(group='ch.qos.logback', module='logback-classic', version='0.9.18'),
@Grab(group='org.slf4j', module='slf4j-api', version='1.5.10')])
@josefbetancourt
josefbetancourt / Gather.groovy
Last active Dec 23, 2015
Code to accompany "Parsing files using Groovy closures" on my blog.
View Gather.groovy
package com.octodecillion
import java.nio.file.Files;
/**
* Simple folder walker and file parser.
* <p>
* Dev with Groovy 2.1.6, Java 7, Eclipse 4.3
*
* @author jbetancourt