Get a VPS that offers 2 or more IP addresses.
From the WHM cPanel, find the menu item Service Configuration
, select Apache Configuration
and then click on Reserved IPs Editor
.
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
The objective of this post is to get you from absolutely nothing, to a fully functional nodejs environment. | |
Software used: Ubuntu 11.10, Nodejs v0.6.12, Nginx, MongoDB, Redis, and NPM modules. | |
1. Download and install the latest version of Ubuntu: http://www.ubuntu.com/download (don't select any extra items to install when prompted) | |
2. Once you are logged in and are at your Ubuntu command prompt, install the necessary software you will need: | |
a. sudo apt-get install openssh-server | |
b. sudo apt-get install libssl-dev | |
c. sudo apt-get install git | |
d. sudo apt-get install g++ | |
e. sudo apt-get install make |
var color = require('colors'); | |
var stdin = process.openStdin() | |
, slides = { | |
1: "\tNode.js" + | |
"\n\n\t\tJavascript running on the server" + | |
"\n\n\t\tWritten in C++ (POSIX)" + | |
"\n\n\t\tWraps V8 JS VM (Google/Chrome)" | |
, 2: "\tOthers / Evented I/O" + | |
"\n\n\t\t > Reactor Pattern" + | |
"\n\n\t\t > EventMachine(Ruby) / Twisted (Python)" + |
<?php | |
/* From https://www.usps.com/send/official-abbreviations.htm */ | |
$us_state_abbrevs_names = array( | |
'AL'=>'ALABAMA', | |
'AK'=>'ALASKA', | |
'AS'=>'AMERICAN SAMOA', | |
'AZ'=>'ARIZONA', | |
'AR'=>'ARKANSAS', |
I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.
From Require.js - Why AMD:
The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"
I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.
#!/bin/bash | |
echo -e "nodejs_installer.sh - \033[37mNode\033[32m\033[32mJS \033[0minstaller for \033[35mRaspberry Pi\033[0m" | |
echo -e "========================================================\n" | |
if [ "$(uname -m)" != "armv6l" ]; then | |
echo -e "\033[31mError: \033[0marmv6l architecture not found. (Are you sure that you are running the script on a Raspberry Pi?)\033[0m"; | |
exit 1; | |
else | |
echo -e "\033[35mRaspberry Pi \033[32mfound! Proceeding...\033[0m" |
<?php | |
// PHP SECURE FILE DOWNLOAD | |
// Put the Files in a directory that is not publically accessible.. maybe outside document root or set correct permissions | |
if (!$_SESSION["authenticated"]) { | |
// If not authenticated then send back to the login page | |
$host = $_SERVER["HTTP_HOST"]; | |
$path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\"); | |
header("Location: http://$host$path/login.php?err=true"); | |
exit; |
// The function that scales an images with canvas then runs a callback. | |
function scaleImage(url, width, height, liElm, callback){ | |
var img = new Image(), | |
width = width, | |
height = height, | |
callback; | |
// When the images is loaded, resize it in canvas. | |
img.onload = function(){ | |
var canvas = document.createElement("canvas"), |
// Implementation in ES6 | |
function pagination(c, m) { | |
var current = c, | |
last = m, | |
delta = 2, | |
left = current - delta, | |
right = current + delta + 1, | |
range = [], | |
rangeWithDots = [], | |
l; |