This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.post('/api/v1/sem/generate_report', function(req, res) { | |
| inspect("Java requested report for account: " + req.body.account_id); | |
| ReportService.generate(req, res, function(credentials, params) { | |
| ReportService.generateReportFor(credentials, params, res, function(engineId) { | |
| ReportService.downloadReportFor[credentials.engine](params, res, credentials, engineId, function(reportFile) { | |
| ReportService.uploadToS3(config.S3.reportBucket + config.S3.s3Suffix, params.s3_storage_path, res, reportFile, function(message) { | |
| res.send(message); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sanitizeFile: function(reportFile, columnAdditions, rowDeletions, callback, retryCount) { | |
| var rs = fs.createReadStream(reportFile, { encoding:'utf8' }) | |
| , outputFile = path.dirname(reportFile) + "/" + path.basename(reportFile) + ".sanitized" | |
| , ws = fs.createWriteStream(outputFile); | |
| rs.on('data', function(data) { | |
| var flushed = ws.write(data); | |
| if (!flushed) { rs.pause(); } | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String post(Service serviceName, Map<String, String> params) throws IOException { | |
| StringBuffer sb = new StringBuffer(); | |
| for (String key:params.keySet()) { | |
| String value = params.get(key); | |
| sb.append(key+"="+value+"&"); | |
| } | |
| String urlParameters = sb.substring(0,sb.length()-1); | |
| URL url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| downloadReport: { | |
| 'default': function(reportFile, requestData, callback) { | |
| var file = fs.createWriteStream(requestData.filename); | |
| var downloadUrl = url.parse(requestData.reportingDownloadUrl); | |
| var local = http.createClient(443, downloadUrl.host, secure=true); | |
| requestData.headers['host'] = downloadUrl.host; | |
| var request = local.request('GET', downloadUrl.pathname + downloadUrl.search, requestData.headers); | |
| request.on('response', function (response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class t { | |
| public static void main(String[] args) { | |
| String[] s = {"1", "2", "3"}; | |
| String[] t = Arrays.copyOfRange(s, 1, 3); | |
| System.out.println("Length of t: " + t.length); | |
| System.out.println(t[0]); | |
| System.out.println(t[1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Instructions: | |
| // (1) Browse to your favorite Trello board | |
| // (2) Drop this into your friendly Chrome inspector or Firefox Firebug console | |
| $('.list').each(function(index) { | |
| var outer = $(this); | |
| $(this).find('h2.current').each(function(index) { | |
| console.log($(this).text() + ': ' + outer.find('.list-card').length) | |
| }) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function minutes_since_last_commit { | |
| now=`date +%s` | |
| last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` | |
| if [ "$?" -ne "0" ]; then | |
| minutes_since_last_commit=-1 | |
| else | |
| seconds_since_last_commit=$((now-last_commit)) | |
| minutes_since_last_commit=$((seconds_since_last_commit/60)) | |
| fi | |
| echo $minutes_since_last_commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('underscore') | |
| var levers = [ | |
| { id: '1', val: 'one'}, | |
| { id: '2', val: 'two'}, | |
| { id: '3', val: 'three'}, | |
| ] | |
| var ids = ['1', '3'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "SELECT * FROM meetings WHERE meetingID = '1';" | |
| "SELECT * FROM meetingAddress WHERE meetingID = '1';" | |
| "SELECT * FROM districts WHERE districtID = '1';" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(data) { | |
| var _data = data | |
| var filter = { | |
| byType: function(query) { | |
| // alter _data | |
| return this | |
| }, | |
| byName: function(query) { | |
| // alter _data |
OlderNewer