Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});
.center-column { | |
float: none !important; | |
margin: 0 auto; | |
} | |
.no-padding-left { | |
padding-left: 0; | |
} | |
.no-padding { | |
padding: 0; | |
} |
Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});
routerHelper.configureStates(getStates(levels), function () { | |
var redirects = '/404'; | |
if($state.current.url === '^') { | |
redirects = '/'; // Or Whatever your homepage is | |
} | |
return redirects; | |
}); |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
Software required:
After installation and putting the youtube-dl
in PATH
youtube-dl \
/* CORS */ | |
const Hapi = require('hapi'); | |
const server = new Hapi(); | |
server.connection({ | |
host: '0.0.0.0', | |
port: this.config.webservice_port, | |
routes: { | |
cors: { |
// List all files in a directory in Node.js recursively in a synchronous fashion | |
var walkSync = function(dir, filelist) { | |
var fs = fs || require('fs'), | |
files = fs.readdirSync(dir); | |
filelist = filelist || []; | |
files.forEach(function(file) { | |
if (fs.statSync(dir + file).isDirectory()) { | |
filelist = walkSync(dir + file + '/', filelist); | |
} | |
else { |
#!/bin/bash | |
# Make .bashrc available to non interactive shells (.sh scripts) | |
export BASH_ENV=~/.bashrc | |
env=~/.ssh/agent.env | |
loadEnv () { | |
test -f "$env" && . "$env" >| /dev/null ; | |
} |
Deploying a node app with Forever is great...until your server restarts unexpectedly. Then your app stops running and you have to re-deploy.
To get around this, we're going to run our node app as an Upstart service. Upstart services are great, because, once started, the system auto-restarts them if they fail, or if the server restarts.
###Step 1: Create a service for your node app
ssh root@youripaddress
service node-app start
/** | |
* Returns the hour difference between two dates | |
*/ | |
function getHours(startDate, endDate) { | |
return Math.floor(Math.abs(startDate - endDate) / 3.6e6); | |
} | |
/** | |
* Returns the current hour in 12-hours format | |
*/ |