Skip to content

Instantly share code, notes, and snippets.

wvengen wvengen

  • Amsterdam, NL
Block or report user

Report or block wvengen

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
@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 / 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 / extend.sh
Last active Jun 17, 2019
Extend non-HiDPI external display above HiDPI internal display
View extend.sh
#!/bin/sh
# extend non-HiDPI external display on DP* above HiDPI internal display eDP*
# see also https://wiki.archlinux.org/index.php/HiDPI
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'`
@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 / scanner.rb
Last active Jul 7, 2017
Hack to use Android phone as barcode scanner for pc
View scanner.rb
#!/usr/bin/env ruby
#
# Hack to use Android phone as barcode scanner for pc.
#
# Installation and setup:
# * Enable usb debugging on your Android phone
# * Make sure you have an Android SDK installed
# * Make sure xdotool is installed (apt-get has it) http://www.semicomplete.com/projects/xdotool/
# * Build and install https://github.com/majido/clipper
# * Start service: `adb shell su -c \'am startservice ca.zgrs.clipper/.ClipboardService\'`
@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 / install_scrapyd.sh
Last active May 31, 2019
Installation script for scrapyd
View install_scrapyd.sh
#
# Installation script for scrapyd on Debian/Ubuntu
# http://scrapyd.readthedocs.org/
#
# - Latest scrapyd from Scrapy package repository
# - Password protection with http basic auth
# - HTTPS with self-signed certificate
# - Works on Amazon EC2
#
FQDN=scrapy.example.com
@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 / select2-freeform.png
Last active Dec 23, 2015
Form input to choose from existing values, while allowing to add new ones (based on select2).
You can’t perform that action at this time.