I hereby claim:
- I am sabind on github.
- I am dansabin (https://keybase.io/dansabin) on keybase.
- I have a public key whose fingerprint is F999 CB15 00DB B34B 4043 90AA 8CE7 D0B7 01E3 543F
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| var _ = require('lodash'); | |
| var numbers = [1, 2, 3, 4]; | |
| var length = numbers.length; | |
| var hasError = false; | |
| // We write a function that takes longer than the loop to complete. | |
| var blowUp = function (current, callback) { | |
| setTimeout(function() { | |
| if (current === 2) { callback(current) } |
This is an addition to a full guide on SailsJS + Mocha, but updated for SailsJS 0.10.x
The guide does not belong to me, only this change to support SailsJS 0.10.x using code originally found in the guide written by it's author.
| shopt -s nullglob | |
| echo "$@" | |
| for f in "$@" | |
| do | |
| echo "$f" | |
| gzip -c "$f" > "$f.gz" | |
| done |
| class ApplicationHelper | |
| def self.register_js_constant(key, value) | |
| constant = "MyApp.constants.#{key.to_s}=#{value.to_json};" | |
| "<script type=\"text/javascript\">#{constant}</script>" | |
| end | |
| end |
| var sendAjaxRequest = function(path, data, callback) { | |
| $.ajax({ | |
| url: path, | |
| type: "POST", | |
| data: data, | |
| headers: {accept: 'application/json'}, //optional based what kind of stuff you need | |
| success: function (response) { | |
| // Response is what you get back. it's contents are based on the API you're calling | |
| if (response.success) { | |
| callback(response.success, response.data, response.code); |
| println("hello world"); |