An updated guide/collection of guides on how to access JSON data with JavaScript
Original Question on Stack Exchange.
For reading the external Local JSON file (data.json) using java script
var express = require('express'), | |
routes = require('./routes'), | |
upload = require('./routes/upload'), | |
http = require('http'), | |
https = require('https'), | |
fs = require('fs'), | |
path = require('path'), | |
httpApp = express(), | |
app = express(), | |
certPath = "cert"; |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
An updated guide/collection of guides on how to access JSON data with JavaScript
Original Question on Stack Exchange.
For reading the external Local JSON file (data.json) using java script
// Usage: | |
// OfflineListener.init(true); | |
define(['angular', 'core'], function(angular){ | |
// Some concepts from: https://github.com/HubSpot/offline | |
var module = angular.module('utils.offline', []); | |
module.service('OfflineListener', function ($rootScope, $window, $alert) { | |
var offlineAlert; |
// Usage: | |
// OfflineListener.init(true); | |
define(['angular', 'core'], function(angular){ | |
// Some concepts from: https://github.com/HubSpot/offline | |
var module = angular.module('utils.offline', []); | |
module.service('OfflineListener', function ($rootScope, $window, $alert) { | |
var offlineAlert; |
var restify = require('restify') | |
, port = process.env.PORT || 3000 | |
, Phantom = require('phantom') | |
, tmpdir = require('os').tmpdir() | |
, fs = require('fs'); | |
var server = restify.createServer(); | |
function setResponseHeaders(res, filename) { | |
res.header('Content-disposition', 'inline; filename=' + filename); |
/** | |
* Example of using an angular provider to build an api service. | |
* @author Jeremy Elbourn (@jelbourn) | |
*/ | |
/** Namespace for the application. */ | |
var app = {}; | |
/******************************************************************************/ |
# Fail2Ban configuration file | |
# | |
# NOTE | |
# You should set up in the jail.conf file, the maxretry and findtime carefully in order to avoid false positives. | |
# | |
# Author: http://www.go2linux.org | |
# Modified by: samnicholls.net | |
# * Mon 6 Jun 2016 - Updated failregex to capture HOST group correctly | |
[Definition] |