This file contains 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 sql = require('mssql'); | |
sql.connect({ | |
user: 'XXXX', | |
password: 'XXXXX', | |
database: 'XXXXX', | |
server: 'XXXXX' | |
}, function(err){ | |
}); |
This file contains 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 ClientInfo(){ | |
this.windows = false; | |
this.linux = false; | |
this.osx = false; | |
this.osArch = { | |
x86: false, | |
x64: false, | |
PowerPC: false | |
}; | |
this.osVersion = { |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Web.Mvc; | |
namespace MySite.Controllers | |
{ | |
public class ServersController : Controller | |
{ | |
This file contains 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 HeavyWork(func, param, cb){ | |
if (window.Worker){ | |
var strFunc = 'onmessage = function(event) {' + | |
' postMessage((' + func.toString() + ')(event.data));' + | |
'}'; | |
var blob = new Blob([strFunc], {type: 'application/javascript'}); | |
var work = new Worker(URL.createObjectURL(blob)) |
This file contains 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
// set the TEST environment variable with TEST=first line\\n\\nsecond line\\n | |
// you need to duplicate the \ to scape it | |
function parseEnvVarible(envVar){ | |
return new Buffer(envVar.split('\\n').join(require('os').EOL), 'UTF-8').toString('UTF-8'); | |
} | |
console.log('Wrong: ' + process.env.TEST); | |
console.log('Right: ' + parseEnvVarible(process.env.TEST)); |
This file contains 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
/** | |
* Read Linux mouse(s) in node.js | |
* Author: Marc Loehe (marcloehe@gmail.com) | |
* | |
* Adapted from Tim Caswell's nice solution to read a linux joystick | |
* http://nodebits.org/linux-joystick | |
* https://github.com/nodebits/linux-joystick | |
*/ | |
var fs = require('fs'), |
This file contains 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
window.angular = {}; | |
window.angular.modules = {}; | |
var originalModuleFunc; | |
var customFunction = function(){ | |
if (arguments.length > 1) { | |
angular.modules[arguments[0]] = originalModuleFunc.apply(null, arguments); | |
return angular.modules[arguments[0]]; | |
}else{ | |
return originalModuleFunc.apply(null, arguments); |
This file contains 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
<div> | |
<wj-flex-grid items-source="data" style="height: 150px;margin-top:10px" control="flex" initialized="initialized(s,e)"> | |
<wj-flex-grid-column header="Country" binding="country" width="*" allow-resizing="false"> | |
<wj-flex-grid-cell-template cell-type="Cell"> | |
<!--<h1>{{$item.country}}</h1>--> | |
<div ng-include="'tpl.html'"></div> | |
</wj-flex-grid-cell-template> | |
</wj-flex-grid-column> | |
<wj-flex-grid-column header="Sales" binding="sales" width="*" allow-resizing="false"></wj-flex-grid-column> | |
<wj-flex-grid-column header="Expenses" binding="expenses" width="*" allow-resizing="false"></wj-flex-grid-column> |
This file contains 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
(JSONString => { | |
let objectString = JSONString; | |
JSONString.match(/"(.*?)":\n*(.*)/gi).forEach(line => { | |
var parts = line.match(/"(.*?)":\n*(.*)/); | |
if (parts[2].match(/^"(.*)",?$/)){ | |
let hasComma = !!parts[2].match(/^"(.*)",{1}$/) | |
parts[2] = '\'' + parts[2].match(/^"(.*)",?$/)[1] + '\'' + (hasComma ? ',': ''); | |
} | |
objectString = objectString.replace(parts[0], parts[1] + ': ' + parts[2]) | |
}) |
This file contains 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
const formidable = require('formidable') | |
const fs = require('fs-extra') | |
const path = require('path') | |
module.exports = ({path: _path}) => { | |
fs.ensureDirSync(_path) | |
return async (req, res) => { | |
const method = req.method.toLowerCase() | |
switch (method) { | |
case 'get': |
OlderNewer