Skip to content

Instantly share code, notes, and snippets.

@wvengen
wvengen / screenshots.rb
Last active Aug 29, 2015
Foodsoft screenshot generation (prototype)
View screenshots.rb
# Generate screenshots for documentation (initial prototype)
# store file in spec/integration/
# run with rspec: `rspec spec/integration/screenshots.rb`
# please note that this uses the db_seeds branch from pr foodcoops#315
require_relative '../spec_helper'
require 'fileutils'
SCREENSHOT_DIR = Rails.root.join('doc/user/screenshots')
describe 'screenshots', :type => :feature do
@wvengen
wvengen / tddium.rake
Last active Aug 29, 2015
Rake task for Heroku deployment on Solano CI
View tddium.rake
# lib/tasks/tddium.rake
#
# Rake task for Heroku deployment on Solano CI
#
# Pushes successful CI builds on the staging branch to Heroku.
# Set HEROKU_APP_NAME and HEROKU_API_KEY in the environment
# and add the worker's SSH public key the Heroku app's accepted keys.
#
# Enjoy! -- wvengen
@wvengen
wvengen / delegate_assign.rb
Created Jan 7, 2015
Active Record mixin to also delegate setters
View delegate_assign.rb
# Also delegate setters with Rails.
#
# If you find yourself wanting to use this, please look at nested attributes first.
# http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
# When that doesn't fit, you may consider the approach shown here.
#
# Example:
#
# class User < ActiveRecord::Base
# include DelegateAssign
@wvengen
wvengen / create_artifact_bundle_for_maven_central.sh
Last active Aug 29, 2015
Create artifact bundle for Maven Central upload
View create_artifact_bundle_for_maven_central.sh
#!/bin/sh
#
# I found the instructions for setting up Maven Central upload in pom.xml too involved.
# This does the job as well, though it requires manually uploading it in Maven Central's
# web interface as an artifact bundle.
#
# Usage:
# 1. Make sure your project is ready and the release version checked out
# 2. Change GPGKEY to point to your key in this script
# 3. Run this script in the directory containing pom.xml
@wvengen
wvengen / genbooks.rb
Last active Aug 29, 2015
HTML Book matrix generator
View genbooks.rb
#!/usr/bin/env ruby
#
# Basic script to retrieve book metadata.
#
# Usage: genbooks.rb <isbn> [<isbn> [...]] >books.json
# Outputs json file with book metadata, for use as input to genpage.rb
#
# TODO
# - add bol.com
# - add amazon.com books
@wvengen
wvengen / README.md
Last active Oct 5, 2015
Running a VST with Carla in a VM using netjack
View README.md

Testing Carla's VST bridge in a VM with netjack

Install Ubuntu Server 15.04 in VirtualBox and enable OpenSSH. Then:

sudo apt-get install -yy apt-transport-https software-properties-common wget
wget https://launchpad.net/~kxstudio-debian/+archive/kxstudio/+files/kxstudio-repos_9.2.0~kxstudio1_all.deb
sudo dpkg -i kxstudio-*.deb

sudo apt-get update

@wvengen
wvengen / select2-freeform.png
Last active Dec 23, 2015
Form input to choose from existing values, while allowing to add new ones (based on select2).
@wvengen
wvengen / list.unlist.js
Last active Dec 24, 2015
listjs templateEngine adding a css class instead of removing rows; based on JuliusR's work, see https://github.com/foodcoops/foodsoft/pull/180
View list.unlist.js
// for use with listjs 0.2.0
// https://github.com/javve/list.js
// PROBABLY UNFINISHED CODE
List.prototype.templateEngines.unlist = function(list, settings) {
var h = window.ListJsHelpers;
// start with standard engine, override specific methods afterwards
this.superClass = List.prototype.templateEngines.standard;
@wvengen
wvengen / Modal.android.js
Last active Jan 13, 2016
Basic Modal for react-native on Android
View Modal.android.js
// Basic Android-implementation of Modal
//
// based on https://github.com/niftylettuce/react-native-loading-spinner-overlay
import React, {StyleSheet, View} from 'react-native';
const Portal = require('react-native/Libraries/Portal/Portal.js');
export default React.createClass({
@wvengen
wvengen / README.md
Last active Jan 25, 2016
d3.chart UMD chart
View README.md

Basic example showing how to make a chart based on d3.chart using the new and shiny UMD interface. This is currently being discussed in #117, and not ready for use. It will be! present from d3.chart 0.3.0 onwards.

  1. git clone https://gist.github.com/5789e5b2a295156ea48e.git && cd 5789e5b2a295156ea48e.git
  2. npm install
  3. webpack index.js build.js
  4. open index.html
  5. see a basic circle graph