react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);
2) get requireAccess func => bindCheckAuth to redux
#!/usr/bin/env python | |
# This is a trick, to output the bash commands we need to run in shell, and just execute this script inside an eval within our shell, so it imports what we need | |
# Possibly tie this in with https://gist.github.com/mbainter/b38a4cb411c0b5c1bae6 for MFA support | |
# Will need to durably store MFA access tokens, possibly in some other env vars | |
# Could also store all different keys/info in different vars, to reuse as needed (lots of env vars though, file may be better) | |
import os | |
import sys | |
import getpass |
if ( | |
process.env.NODE_ENV === 'production' && | |
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ && | |
Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length | |
) { | |
window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers = {} | |
} |
/** | |
* Required Variables. | |
*/ | |
variable "name" {} | |
variable "port" {} | |
variable "elb_security_group" {} | |
variable "elb_subnets" {} |
Factory.define :application do |factory| | |
factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
end |
import re | |
def convert_1252_codes(text): | |
"""Convert windows-1252 characters to appropriate html entities. | |
@param str String to filter | |
@type string/unicode | |
@return unicode version of filtered string | |
Adapted from: http://effbot.org/zone/unicode-gremlins.htm |
#!/bin/bash | |
# This script can be used in "run & hope" mode or you can use it as a recipe to | |
# do things manually - you probably want the latter if you really care about | |
# the data in your databases. | |
# Happy hacking | |
# /Eoin/ | |
# Tell bash to stop if something goes wrong | |
set -e |
// Observable is an Union Type, with the following variants | |
const Empty = () => ['EMPTY'] | |
const Cons = (head, tail) => ['CONS', head, tail] | |
const Future = promise => ['FUTURE', promise] | |
// race between 2 promises; each promise will resolve to a lazy value | |
const lazyRace = (p1, p2) => Promise.race([p1,p2]).then(lazy => lazy()) | |
// function composition | |
const compose = (...fns) => (arg) => fns.reduceRight((res, f) => f(res), arg) |
react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);
2) get requireAccess func => bindCheckAuth to redux
Capybara.add_selector :record do | |
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) } | |
match { |record| record.is_a?(ActiveRecord::Base) } | |
end |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |