Skip to content

Instantly share code, notes, and snippets.

@craigbeck
craigbeck / bad-query.gql
Last active May 12, 2016 22:37
extra ids in query
query RootQueryType {
recentConversations {
id
...F2
}
}
fragment F0 on Conversation {
id
unreadCount
{
profile {
id
name
email
}
lines {
id
number
@craigbeck
craigbeck / fixsemi.js
Created March 15, 2016 22:45
automatic fix semicolons from eslint output
#!/usr/bin/env node
var fs = require("fs");
function fixFile(filename, lineNumbers) {
fs.readFile(filename, { encoding: "utf-8", flag: "r" }, function (err, buffer) {
if (err) {
console.error("Could not read", filename, err);
return;
}
@craigbeck
craigbeck / design-elements.md
Created March 11, 2016 22:56
Design pointers and considerations for web apps

Frequently missing components

  • empty view; what about when there is no data?
  • tansitions; animations?
  • busy indicators; spinners, interstitial views
  • error views
    • view?
    • alert?
  • global alerting
  • "new version available"
@craigbeck
craigbeck / license.txt
Created September 11, 2013 17:57
Blessing License
The author disclaims copyright to this source code. In place of a legal
notice, here is a blessing:
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give.
It is based on a snipped found in this project:
https://github.com/martinblech/mimerender
@craigbeck
craigbeck / find-builds.sh
Last active December 22, 2015 11:58
find files by pattern but don't look in certain directories
#!/bin/sh
# as @nobody
find . -not \( -path */archive -prune \) -name *-Linux-*.tar.gz
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
@craigbeck
craigbeck / gist:5376338
Created April 13, 2013 00:58
Elasticsearch file descriptor limits in AWS EC2 Ubuntu instance - how to fix when running under daemontools
1. change `/etc/init/sfsvscan.conf` and add `limit nofile 32000 32000`
2. change `/etc/security/limits.conf` and add
`* hard nofile 40960`
`* soft nofile 40960`
3. confirm by adding `-Des.max-open-files=true` to run file of elasticsearch
@craigbeck
craigbeck / query-syntax.peg
Last active December 11, 2015 21:08
updated to return tree
start =
compoundExp
/ exp
op =
equals
/ logicalOp
/ stringOp