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 flat(obj) { | |
var result = {}; | |
for (var key in obj) { | |
if (typeof obj[key] == "object") { | |
var flatObj = flat(obj[key]); | |
for (var subkey in flatObj) { | |
result[key + "." + subkey] = flatObj[subkey]; | |
} | |
} else { | |
result[key] = obj[key]; |
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 http = require('http'); | |
const RED = require("node-red"); | |
const express = require("express"); | |
const app = express(); | |
const server = http.createServer(app); | |
const settings = require('./settings'); |
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 dash = require('appmetrics-dash'); | |
dash.monitor({port:4000}); | |
const http = require('http'); | |
const RED = require("node-red"); | |
const express = require("express"); | |
const app = express(); | |
const server = http.createServer(app); |
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 http = require('http') | |
const RED = require("node-red") | |
const polka = require('polka') | |
const server = http.createServer() | |
const app = polka({server}) | |
const settings = require('./settings') |
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
#!/bin/bash | |
# https://cloud.google.com/compute/docs/faq#ipranges | |
#nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8 | |
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :` | |
do | |
dig txt $LINE +short | |
done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n |
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
//index.js | |
const cote = require('cote') | |
const winston = require('winston') | |
const timeService = new cote.Responder({ name: 'Time Service' }) | |
timeService.on('time', (req) => { | |
return new Promise((resolve, reject) => { | |
let date = new Date() | |
resolve(date) |
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
<?php | |
namespace MyApp\Lua; | |
/** | |
* Use with Predis | |
**/ | |
class HashIterate extends \Predis\Command\ScriptCommand | |
{ | |
public function getKeysCount() | |
{ |
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
local function compare(frase1, frase2) | |
local function letterPairs(word) | |
local numPairs = string.len(word) | |
local wPairs = {} | |
local cnt = 1 | |
while cnt < numPairs do | |
local pedaco = string.sub(word,cnt,cnt+1) | |
table.insert(wPairs,pedaco) | |
cnt = cnt + 1 | |
end |
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 compare(frase1, frase2) | |
function letterPairs(word) | |
numPairs = string.len(word) | |
wPairs = {} | |
cnt = 1 | |
while cnt < numPairs do | |
pedaco = string.sub(word,cnt,cnt+1) | |
table.insert(wPairs,pedaco) | |
cnt = cnt + 1 | |
end |
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
POST /loja/v1.0/produtos HTTP/1.1 | |
Content-Type: application/json | |
{ | |
"nome" : "Guitarra Fender Stratocaster Preta", | |
"preco" : 8500.00 | |
} | |
//------RESPOSTA------- | |
HTTP/1.1 201 Created |
NewerOlder