Skip to content

Instantly share code, notes, and snippets.

@adamdawkins
adamdawkins / dogs-recompose.js
Created October 16, 2018 12:57
recompose Dogs.js
import gql from "graphql-tag";
import { graphql } from 'react-apollo'
import { compose } from 'recompose'
import { withLoading, withError } from '../helpers'
const GET_DOGS = gql`
{
dogs {
id
breed
@adamdawkins
adamdawkins / dogs.js
Created October 16, 2018 12:52
Apollo <Query> example
import gql from "graphql-tag";
import { Query } from "react-apollo";
const GET_DOGS = gql`
{
dogs {
id
breed
}
}
0xaa7FA506d7A6d59ee05829439470589c0bEC45D6
@adamdawkins
adamdawkins / trello-focus.js
Created July 24, 2017 10:13
Trello focus: something to paste into the console to hide all lists except the 'now' list.
function focus(label = 'Now') {
$(`[aria-label="${label}"]`).parent().parent().parent().attr('id', 'focus');
$('.list-wrapper:not(#focus)').hide();
$('#header').hide()
$('.board-header').hide();
$('body').css({background: '#fff', fontSize: '18px'});
$('.list').css({background: '#fff', maxWidth: '100%'});
$('.list').css({background: '#fff', maxWidth: '100%'});
$('.list-card').css({maxWidth: '100%', overflow: 'auto', opacity: .5, border: 'none' });
" File: .vim/syntax/rdoc.vim
" RDoc inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
" ------------ _____________________ --------------------------- ________________________ ----------------- __
syntax match rdocInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
HtmlHiLink rdocInlineURL htmlLink
@adamdawkins
adamdawkins / command
Created January 18, 2013 13:30
Find rogue Rails server
lsof -i TCP:3000
@adamdawkins
adamdawkins / _form.html.erb
Created June 10, 2011 16:28
'find or create by' Rails
<%= form_for(@quote) do |f| %>
<% if @quote.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@quote.errors.count, "error") %> prohibited this quote from being saved:</h2>
<ul>
<% @quote.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>