Skip to content

Instantly share code, notes, and snippets.

@joshkh
Created August 28, 2015 09:15
Show Gist options
  • Save joshkh/95a8d06315f93623aca6 to your computer and use it in GitHub Desktop.
Save joshkh/95a8d06315f93623aca6 to your computer and use it in GitHub Desktop.
grunt
request = require 'request'
imjs = require 'imjs'
class maintest
constructor: ->
console.log "maintest constructed"
post: ->
request.post 'http://httpbin.org/post', form: {key:'value'}, (err, res) ->
console.log "err", err
console.log "res", res
im: ->
query =
'from': 'Gene'
'select': [
'secondaryIdentifier'
'symbol'
'primaryIdentifier'
'organism.name'
]
'orderBy': [ {
'path': 'secondaryIdentifier'
'direction': 'ASC'
} ]
'where': [ {
'path': 'Gene'
'op': 'LOOKUP'
'value': 'zen'
'extraValue': ''
'code': 'A'
} ]
flymine = new imjs.Service root: 'www.flymine.org/query'
flymine.rows(query).then (res) ->
console.log "imjs query", res
rawquery: ->
opts =
encoding: 'utf8'
method: 'POST'
url: 'http://www.flymine.org/query/service/query/results'
form:
format: 'json'
query: '<query model="genomic" view="Gene.secondaryIdentifier Gene.symbol Gene.primaryIdentifier Gene.organism.name" sortOrder="Gene.secondaryIdentifier ASC" ><constraint path="Gene" op="LOOKUP" value="zen" extraValue="" code="A" /></query>'
x = request opts
# debugger;
data = []
x.on 'data', (res) ->
console.log "res", res
x.on 'end', ->
console.log "got to the end"
debugger;
# x.end()
# console.log "err", err
# console.log "res", res
# req.end()
module.exports = maintest
# Create a new configuration function that Grunt can
# consume.
module.exports = ->
# Initialize the configuration.
@initConfig
# Specify source files to the JSHint task.
browserify:
main:
files: 'build/main.js': ['src/main.coffee']
options:
transform: ['coffeeify']
browserifyOptions:
standalone: 'IMAPP'
watch:
scripts:
files: ['src/**/*']
tasks: ['browserify']
# Load external Grunt task plugins.
@loadNpmTasks "grunt-browserify"
@loadNpmTasks "grunt-contrib-watch"
# Default task.
@registerTask "default", ["browserify"]
<!DOCTYPE html>
<html>
<head>
<script src="build/main.js"></script>
</head>
<body>
<h1>Sup.</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment