Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tarjei
tarjei / InComponent.html
Last active June 6, 2018 12:29
Problem getting radio group to fire
<div class="form-gdpr">
<div class="form-gdpr-title">Ønsker du en gang i blant å bli kontaktet om spennende nye tilbud og tjenester?</div>
<div class="form-group check-group">
<label class="ip-label-check form-gdpr-ok" for="form-marketing">
<input type="radio"
value='1'
bind:group=userData.marketing
name="marketing"
class="ip-check"
id="form-marketing"/>
@tarjei
tarjei / LocalReducer.js
Created September 26, 2017 11:11
Recompose withReducer + withHandlers but as a simple render function component.
import React, { Component } from 'react'
import PropTypes from 'prop-types'
export default class LocalReducer extends Component {
static propTypes = {
handlers: PropTypes.object.isRequired,
mapPropsToInitialState: PropTypes.func.isRequired,
reducer: PropTypes.func.isRequired,
render: PropTypes.func.isRequired,
reducerKey: PropTypes.string
@tarjei
tarjei / router_v4_syntax_change.js
Created May 11, 2017 08:25
V4 routes optional syntax changed
// Before:
<route path="/path(:optional?)" />
// new
<route path="/path/:optional?" />
@tarjei
tarjei / my_enzyme_test.js
Created May 11, 2017 08:22
React Router V4 tests using enzyme to trigger route requires {button:0}
// will not trigger click:
page.find('a').simulate('click')
// works
page.find('a').simulate('click', {button:0})
@tarjei
tarjei / fixSpaces.php
Created January 3, 2017 14:42
Fix spaces in mysql rows
<?php
$host = '127.0.0.1';
$db = 'dbname';
$user = 'username';
$pass = 'password';
$charset = 'utf8';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$opt = [
@tarjei
tarjei / Modal.jsx
Created June 17, 2014 11:02
Foundation.reveal as a React.js component
/**
* @jsx React.DOM
*/
var React = require('react/addons');
/* the link component is used to navigate away from th current url. Some of it is app spesific and
therefore not included here. */
var Link = require('../components/Link.jsx');
var cx = React.addons.classSet;
@tarjei
tarjei / commit-msg
Created April 20, 2012 09:07
Git callaback to add issuenumber to commit message
#!/bin/bash
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# Based on another example commit-msg hook I found here:
# https://review.typo3.org/Documentation/user-changeid.html