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
# | |
# Sample Dockerfile for installing balena-cli on Ubuntu Bionic | |
# Usage: | |
# $ docker build -t cli-ubuntu . | |
# $ docker run -it cli-ubuntu | |
# | |
# # Then on the container: | |
# $ which balena | |
# /usr/local/nvm/versions/node/v10.16.0/bin/balena | |
# $ balena version |
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'); //Otetaan http lisäosa käyttöön | |
http.createServer(function (req, res) { //Luodaan palvelin vastaanottamaan pyyntöjä | |
http.get(req.url, (vastaus) => { //Tehdään pyyntö perustuen käyttäjän luoman pyynnön sisältävään urliin | |
let data = ''; //Luodaan vain tälle lohkolle oma data muuttuja | |
vastaus.on('data', (osio) => { //Aina kun urlista tulee dataa laitetaan se data muuttujaan | |
data += osio; | |
}); | |
vastaus.on('end', () => { //Kun datan tulo loppuu lähetetään http palvelimen avulla data. Säästetään tilaa käyttämällä vain res.endiä eikä res.writeä ja res.endiä | |
res.end(data); |
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 spawn = require('cross-spawn'); | |
const path = require('path') | |
const ls = spawn.sync('npm', ['ls','--json']); | |
const tree = JSON.parse(ls.stdout) | |
const walkDepTree = (tree,cb) => { | |
const deps = tree.dependencies | |
if(deps) { |
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 | |
/* From: http://www.php.net/manual/en/function.str-getcsv.php#88773 and http://www.php.net/manual/en/function.str-getcsv.php#91170 */ | |
if(!function_exists('str_putcsv')) | |
{ | |
function str_putcsv($input, $delimiter = ',', $enclosure = '"') | |
{ | |
$csv = fopen('php://temp','r+'); |