Skip to content

Instantly share code, notes, and snippets.

View andywer's full-sized avatar

Andy Wermke andywer

View GitHub Profile
@andywer
andywer / gist:7881831
Created December 9, 2013 22:04
JRuby + Gradle + Bundler
andy@ubuntu-vostro:~/workspace/index-vivus$ ./gradlew ruby -PcmdArgs='-S bundle install'
:backend:compileJava UP-TO-DATE
:backend:processResources UP-TO-DATE
:backend:classes UP-TO-DATE
:frontend:ruby
/home/andy/workspace/index-vivus/frontend/ruby/jruby-1.7.8/bin/jruby --1.9 -J-cp /home/andy/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/13.0.1/d6f22b1e60a2f1ef99e22c9f5fde270b2088365/guava-13.0.1.jar:/home/andy/.gradle/caches/modules-2/files-2.1/log4j/log4j/1.2.17/5af35056b4d257e4b64b9e8069c0746e8b08629f/log4j-1.2.17.jar:/home/andy/workspace/index-vivus/backend/build/classes/main:/home/andy/workspace/index-vivus/backend/build/resources/main -S bundle install
Gem::LoadError: Could not find 'bundler' (>= 0) among 0 total gem(s)
to_specs at /home/andy/workspace/index-vivus/frontend/ruby/jruby-1.7.8/lib/ruby/shared/rubygems/dependency.rb:298
to_spec at /home/andy/workspace/index-vivus/frontend/ruby/jruby-1.7.8/lib/ruby/shared/rubygems/dependency.rb:309
gem at /home/andy/workspace/index-vivu
@andywer
andywer / gist:7912933
Created December 11, 2013 15:57
And a new problem... Related to Gradle + Maven
andy@ubuntu-vostro:~/workspace/index-vivus$ ./railscmd rails s
Error listing versions of com.google.guava:guava:13.+ using class org.gradle.api.internal.artifacts.repositories.resolver.MavenVersionLister$1. Will attempt an alternate way to list versions. This behaviour has been deprecated and is scheduled to be removed in Gradle 2.0
Error listing versions of log4j:log4j:1.2.+ using class org.gradle.api.internal.artifacts.repositories.resolver.MavenVersionLister$1. Will attempt an alternate way to list versions. This behaviour has been deprecated and is scheduled to be removed in Gradle 2.0
FAILURE: Build failed with an exception.
* Where:
Build file '/home/andy/workspace/index-vivus/frontend/build.gradle' line: 40
* What went wrong:
@andywer
andywer / pool-functional.spec.js
Created March 1, 2016 20:46
Functional test spec for threads.js pool (reproducing #12)
import expect from 'expect.js';
import { Pool } from '../../lib/';
describe('Pool (functional test)', () => {
const pool = new Pool();
const jobs = [], promises = [];
const handler = (input, done) => {
done(input);
};
@andywer
andywer / index.js
Last active July 8, 2016 11:59
Resticle usage idea (HATEOAS)
import { createApi, Schema } from 'resticle'
import { githubHrefResolver } from './middlewares.js'
const api = createApi()
api.use(githubResolver)
const Repo = api.createModel('repo')
const User = api.createModel('user', {
repos: Schema.Collection(Repo)
})
@andywer
andywer / index.js
Last active July 8, 2016 11:59
Resticle usage idea (ID-based, writeable)
import { createApi, Schema } from 'resticle'
import { httpOptions } from 'resticle-middlewares'
const api = createApi()
api.use(httpOptions({
Authorization: 'Bearer someSuperSecretToken'
}))
const Post = api.createModel('post', {
@andywer
andywer / index.js
Created July 7, 2016 18:38
Resticle low-level API usage idea
import { createApi } from 'resticle'
import { httpOptions } from 'resticle-middlewares'
const api = createApi()
api.use(httpOptions({
Authorization: 'Bearer someSuperSecretToken'
}))
playAroundWithTheApi()
@andywer
andywer / index.js
Created July 8, 2016 09:57
Resticle idea: Additional gimmicks
import { createApi, Schema } from 'resticle'
const api = createApi('/api')
// Don't Repeat Yourself: Small middleware function to automatically provide `created_at` and `updated_at` timestamps
api.use(function timestampsMiddleware (api) {
api.extendModels((model, schema) => {
// Extend schema if timestamps are not already defined
schema.created_at = schema.created_at || Schema.Date()
schema.updated_at = schema.updated_at || Schema.Date()
@andywer
andywer / passway.md
Last active August 26, 2016 22:27
Idea: Make REST communication as easy as a function call

Passway - Make REST communication as easy as a function call

What is this about?

  • Make message passing using REST as easy and convenient as possible
  • Convention over configuration for the basics, middleware concept for more powerful stuff
  • Make it easy for people to design software in microservices and provide open APIs

Sample shows code of a small demo page for doing a simple mathematical addition of two numbers (method calculation). Calculation is done on the server.

@andywer
andywer / index.js
Created September 16, 2016 07:00
Listr 0.6.0 Issue
const execa = require('execa')
const Listr = require('listr')
const Observable = require('zen-observable')
const rootListr = new Listr([
{
title: 'root',
task: () => new Listr([
{
title: 'sleep 1s',
@andywer
andywer / sample.js
Created September 16, 2016 10:12
Listr Verbose Renderer Issue
const execa = require('execa')
const Listr = require('listr')
const rootListr = createListr([
{
title: 'root',
task: () => createListr([
{
title: 'sleep 1s',
task: () => execa.shell('echo "Sleeping 1s" && sleep 1 && echo "Done sleeping"')