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 str = '0x41FC6733'; | |
function parseFloat(str) { | |
var float = 0, sign, order, mantiss,exp, | |
int = 0, multi = 1; | |
if (/^0x/.exec(str)) { | |
int = parseInt(str,16); | |
}else{ | |
for (var i = str.length -1; i >=0; i -= 1) { | |
if (str.charCodeAt(i)>255) { |
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
'use strict' | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const path = require('path'); | |
const app = express(); | |
//Handler to provider any function to parse in ObjectId | |
String.prototype.toObjectId = function() { | |
var ObjectId = (require('mongoose').Types.ObjectId); | |
return new ObjectId(this.toString()); |
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
$stmt = $dbh->prepare(' | |
SELECT | |
* | |
FROM | |
table | |
ORDER BY | |
name | |
LIMIT | |
:limit | |
OFFSET |
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
1 - Após o acesso SSH na instância da amazon efetue atualize os pacotes da distribuição | |
$ sudo apt-get update | |
$ sudo apt-get upgrade | |
2 - Instalar o APACHE | |
$ sudo apt-get install apache2 -y | |
3 - Instalar o MySQL | |
$ sudo apt-get install mysql-server mysql-client -y |
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
const func1 = () ={ | |
console.log("sou a func 1); | |
} | |
const func2 = () ={ | |
console.log("sou a func 2); | |
} | |
module.exports = { | |
func1, |
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
'use strict' | |
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
let companySchema = new Schema({ | |
cnpj: String, | |
ie: String, | |
razaoSocial: String, | |
nomeFantasia: String, | |
endereco: { |
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
'use strict' | |
const Model = require('../models/company'); | |
const create = (obj) => { | |
return Model.create(obj); | |
}; | |
const remove = (uid) => { | |
let query = {uid: uid}; | |
return Model.remove(query); |
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
'use strict' | |
const express = require('express'); | |
const router = express.Router(); | |
const Ctrl = require('../controllers/companyCtrl'); | |
const callback = (data, res) => { | |
res.json(data); | |
}; | |
const errorHandler = (err, res) => { |
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 filesPath = ["file:///storage/emulated/0/myfile.txt","file:///storage/emulated/0/folder", "file:///storage/emulated/0/other-file.txt"]; | |
function processFilesPaths(filesPath) { | |
angular.forEach(data, function (filePath) { | |
window.resolveLocalFileSystemURL(filePath, function (fileEntry) { | |
fileEntry.file(function (file) { | |
vm.attachments.push(file); | |
}); | |
}); | |
}); |
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
angular.module('starter') | |
.factory("$fileFactory", function ($q) { | |
var File = function () { }; | |
File.prototype = { | |
getParentDirectory: function (path) { | |
var deferred = $q.defer(); |
OlderNewer