Skip to content

Instantly share code, notes, and snippets.

View benjie's full-sized avatar

Benjie benjie

View GitHub Profile
module.exports = function PgUpsertPlugin(
builder,
{ pgDisableDefaultMutations }
) {
if (pgDisableDefaultMutations) {
return;
}
builder.hook("inflection", (inflection, build) =>
build.extend(inflection, {
# Ensure all foreign key constraints heve 'ON DELETE' clauses
grep 'FOREIGN KEY.* REFERENCES .*' db/schema.sql | grep -v ' ON DELETE '
if [ "$?" == "0" ]; then
echo "Foreign key constraints without delete instructions - aborting"
exit 2;
fi;
@koistya
koistya / ReactJS-Server-Side-Rendering.md
Last active September 15, 2023 07:32
Server-side Rendering (SSR) for ReactJS / Flux Applications. Setting document.title

Files

The basic structure of a React+Flux application (see other examples)

 - /src/actions/AppActions.js     - Action creators (Flux)
 - /src/components/Application.js - The top-level React component
 - /src/constants/ActionTypes.js  - Action types (Flux)
 - /src/core/Dispatcher.js        - Dispatcher (Flux)
 - /src/stores/AppStore.js        - The main store (Flux)
@benjie
benjie / README.md
Last active August 29, 2015 13:56
Mocha uncaughtException workaround

Workaround Mocha's Assertion Catching

(For Node.js only.)

To protect mocha tests (and before and after commands) from uncaught exceptions, in each test file:

{protect} = require './test_helper'
protect()
@robotmay
robotmay / dashing-heroku.md
Last active November 29, 2016 11:59
Heroku jobs for Dashing. Returns the number of active dynos for each process type (including custom processes). Set your Heroku keys as environment variables.

Add the following to your Gemfile:

gem 'heroku-api'

Put heroku.rb in your jobs folder and add the contents of heroku.html into your layout.

@davidmatas
davidmatas / mou.html
Last active March 1, 2023 16:42
highlight syntax for Mou.app
<!-- Highlight syntax for Mou.app, insert at the bottom of the markdown document -->
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.3/styles/github.min.css">
<script>
hljs.initHighlightingOnLoad();
</script>
@benjie
benjie / README.md
Created May 15, 2012 13:53
`git bisect` demo using CoffeeScript 1.3.2 "=> super" bug

To run this,

git clone git://github.com/jashkenas/coffee-script.git
cd coffee-script

Copy test.sh into the coffee-script directory, then

git bisect start
# git checkout 1.3.2

sh test.sh # FAIL -> BAD

@cmcculloh
cmcculloh / post-receive-email
Created November 18, 2010 19:52
Example of a post receive email file called by a git hook that sends a color coded formatted html email of the git diff
#!/bin/sh
#
# Copyright (c) 2007 Andy Parkins
#
# An example hook script to mail out commit update information. This hook
# sends emails listing new revisions to the repository introduced by the
# change being reported. The rule is that (for branch updates) each commit
# will appear on one email and one email only.
#
# This hook is stored in the contrib/hooks directory. Your distribution