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
This Gist will help you configure SSL on a pure Node.js server | |
(without a server like Apache/nginx, but you should probably use it in production!) |
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
# First, run your node script with nohup | |
# (keep the "&" at the end, it puts the process in teh background) | |
nohup node server/index.js --port 8443 & | |
# Now we capture the process ID so we know what to kill later | |
export SERVER_PID=$!; | |
echo $SERVER_PID; | |
# Sleep 5 Seconds to allow the server script time to startup |
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
'use strict'; | |
// Modules | |
var request = require('request'); | |
var nock = require('nock'); | |
// API You want to use/mock/test | |
var api_url = 'http://api.example.com'; | |
// You can put this into a separate .json file and just require() it |
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 | |
# http://forums.powervps.com/showthread.php?t=1313 | |
# f = background | |
ssh -Ngf -L 12345:127.0.0.1:3306 [email protected] |
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
'use strict'; | |
// Firstly, please don't use this in production. | |
// Use nginx forwarding/upstream instead | |
// Nginx is way more secure and battle-tested | |
// ################ | |
// ### Method 1 ### | |
// ################ |
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
'use strict'; | |
// I'd strongly recommend not using Socket.io rooms | |
// This will make it more difficult to switch to another | |
// WebSocket library that may not support rooms (SockJS?) | |
// You can use Redis or another data store to create rooms and add/remove users | |
// But, here it is for historical and educational purposes | |
// Socket.IO v0.7 now gives you one Socket per namespace you define: |
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
'use strict'; | |
// Modules | |
var request = require('request'); | |
// Variables | |
var settings = { | |
host : 'http://localhost:8443', | |
version : 'v0', | |
verifySSL : false, |
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
{ | |
"auto_complete": false, | |
"auto_match_enabled": false, | |
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme", | |
"draw_white_space": "all", | |
"font_size": 21, | |
"highlight_modified_tabs": true, | |
"line_numbers": true, | |
"open_files_in_new_window": false, | |
"preview_on_click": false, |
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
curl -o /usr/local/bin/prettyjson https://gist.githubusercontent.com/ryanlelek/78fc643886628e454a56/raw/12380b8ab13b9c23e1c34c9fe996c01e40b2eccb/prettyjson.py; chmod +x /usr/local/bin/prettyjson; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Credit: http://stackoverflow.com/questions/22196587/how-to-center-align-vertically-the-container-in-bootstrap --> | |
<title>Bootstrap Centered Jumbotron</title> | |
<meta charset="utf-8" /> | |
<link type="text/css" rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.css" /> | |
<style type="text/css"> |
OlderNewer