Skip to content

Instantly share code, notes, and snippets.

View radekstepan's full-sized avatar

Radek Stepan radekstepan

View GitHub Profile
@radekstepan
radekstepan / organisms.diff
Created January 30, 2014 13:48
Shows an organisms dropdown on homepage list upload like on Lists page
diff --git a/intermine/web/main/src/org/intermine/web/struts/BeginAction.java b/intermine/web/main/src/org/intermine/web/struts/BeginAction.java
index b5a4979..477789e 100644
--- a/intermine/web/main/src/org/intermine/web/struts/BeginAction.java
+++ b/intermine/web/main/src/org/intermine/web/struts/BeginAction.java
@@ -18,6 +18,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Iterator;
// ==UserScript==
// @name DuoSkipper
// @description Skip test questions on Duolingo by pressing Enter.
// @include https://www.duolingo.com/practice
// @version 1.0
// ==/UserScript==
window.addEventListener('load', function() {
$(document).keypress(function(evt) {
if (evt.keyCode == 13) {
@radekstepan
radekstepan / gist:b3b4dad29e97f589928e
Created October 14, 2014 16:33
Edmonton communities and their locations
{
"data": [
{
"name": "Abbottsfield, Edmonton",
"type": "community",
"number": 2010,
"socrata_id": "q9gm-x3wv",
"lat": 53.5737301566926,
"lon": -113.38966126012794,
"zoom": 13
@radekstepan
radekstepan / events.js
Created October 20, 2014 16:01
Listening to events in Ractive
var test = require('tape');
var Ractive = require('ractive');
var _ = require('lodash');
var mediator = require('../src/js/app/modules/mediator.js');
test('mediator subscriptions get cancelled', function(t) {
var called = 0;
@radekstepan
radekstepan / issues.md
Last active August 29, 2015 14:08
Issues with Ractive

#Issues with Ractive

  • multiple transitions of the same component would not clear listeners leading to zombies in memory and ultimate browser crash; fixed in 0.6.0
  • events like tap do not work together with adapters like ractive-ractive because one uses dependencies and one uses peerDependencies
  • deeply nested POJO saved as a map with set triggers a change even if nothing has changed
  • ractive-ractive does not update parent model if we have passed in its subset like parent.name instead of parent; the data gets changed but no update event gets fired
  • setting a key to [] (resetting an array) has won't clear the array items from memory if they were linked to components, a while loop on all the items in the array and their subsequent pop works
  • an error in a component fails silently killing with it some part of the template logic
  • does not handle tags in templates that seem unclosed because they are closed in an if condition
  • have to do this `listing="{{ { 'ID': ID
[[PageOutline]]
The following items should be tested before each release. Be sure to vary the following:
* super | regular user
* logged in | out
* Firefox, IE 7/9, Chrome, Safari
* new | old user
= ACCOUNT =
@radekstepan
radekstepan / merge.coffee
Created September 8, 2013 12:35
merge pdfs together
fs = require 'fs'
path = require 'path'
async = require 'async'
{ exec } = require 'child_process'
outs = []
async.each ( file for file in fs.readdirSync('.') when path.extname(file) is '.pdf' ), (file, cb) ->
outs.push out = path.basename(file, '.pdf') + 'decrypted.pdf'
exec "qpdf #{file} #{out} --decrypt", cb
defmodule C do
def map([], _), do: []
def map([ head | tail ], func) do:
[ func.(head), map(tail, func) ]
end
def child(element, func, parent) do:
parent <- { self, func.(element) }
end
#!/usr/bin/env coffee
http = require 'http'
# Which mine?
mine = 'http://beta.flymine.org/beta'
# Replace multiple whitespace with a single space.
clean = (text) -> text.replace(/\s+/g, ' ')
# Get the services listing.
@radekstepan
radekstepan / .gitignore
Last active March 4, 2016 09:25
Merge two sorted arrays into a sorted array of unique values from both
/node_modules
*.log
.DS_Store