Skip to content

Instantly share code, notes, and snippets.

View staticnull's full-sized avatar

static staticnull

View GitHub Profile
import grails.util.*
class Env {
static String getEnvironmentName() { Environment.getCurrent().getName() }
static boolean isDevelopment() { GrailsUtil.isDevelopmentEnv() }
static boolean isDevelopmentOrTest() { isDevelopment() || isTest() }
static boolean isNotDevelopmentOrTest() { !isDevelopmentOrTest() }
@staticnull
staticnull / .git_bash
Created May 8, 2015 16:08
Git aliases and functions - Similar to @rappleg's original
# Git completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Git
alias gco='git checkout'
alias status='git status'
alias stat='git status'
alias pop='git stash pop'

Keybase proof

I hereby claim:

  • I am staticnull on github.
  • I am staticnull (https://keybase.io/staticnull) on keybase.
  • I have a public key whose fingerprint is 3922 6BC1 6590 60F6 7A32 CD98 BE1C 8F3F 818F E24D

To claim this, I am signing this object:

@staticnull
staticnull / gist:1dd2c1ad11fcb8382a9c
Last active August 29, 2015 14:12
Report Demo - HTML Button + Controller
<!-- On an HTML page before the report -->
<button class="btn btn-success" ng-click="generateReport()"><span class="fa fa-file-pdf-o"></span> Generate Report</button>
<!-- demo.coffee -->
'use strict'
angular.module('demo').controller 'DemoCtrl', ($scope, $stateParams, $state, $q, $window, ReportService, profile, evaluation, group) ->
...
# Report
$scope.generateReport = () ->
@staticnull
staticnull / gist:3e0ea8dd9f2d4480a49b
Last active August 29, 2015 14:12
Report Demo - rasterizestdout.js
var page = require('webpage').create(),
system = require('system'),
address, output, size;
if (system.args.length < 3 || system.args.length > 5) {
console.log('Usage: rasterizestdout.js URL footerImageURL filename [paperwidth*paperheight|paperformat] [zoom]');
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
phantom.exit(1);
} else {
address = system.args[1];
@staticnull
staticnull / gist:0189fe2a8faf07262c4a
Last active August 29, 2015 14:12
Report Demo - Config.groovy
environments {
development {
grails.logging.jul.usebridge = true
grails.phantomPDFScript = "ui/app/scripts/phantomjs/rasterizestdout.js"
grails.serverURL = "http://localhost:8080/demo"
}
devserver {
grails.logging.jul.usebridge = false
grails.phantomPDFScript = "/opt/tomcat/webapps/first-step/scripts/phantomjs/rasterizestdout.js"
grails.serverURL = "http://surlylabs.com:8080/demo"
@staticnull
staticnull / gist:27a4a1aa472738181faf
Last active August 29, 2015 14:12
Report Controller
package demo
class ReportController {
/**
* Generate PDF report
*
* phantomjs ./scripts/phantomjs/rasterizestdout.js <url of report> <name>.pdf <url of footer>
*
* http://stackoverflow.com/questions/12403817/phantomjs-pipe-input/17286691#17286691
* Need this link in rasterize.js:
@staticnull
staticnull / _Events.groovy
Created November 26, 2014 19:45
Grails 2.2.4 - Custom test phase
import org.codehaus.groovy.grails.test.junit4.JUnit4GrailsTestType
import org.codehaus.groovy.grails.test.support.GrailsTestMode
// http://ldaley.com/post/615966534/custom-grails-test
def cassandraTestTypeName = "cassandra"
def cassandraOrmTestTypeName = "cassandraOrm"
def testMode = new GrailsTestMode(autowire: true, wrapInTransaction: true, wrapInRequestEnvironment: true)
// 1. Add the name of your phase to this variable with this event handler
eventAllTestsStart = {