This file contains hidden or 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 Koa = require('koa'); | |
| const app = new Koa(); | |
| const server = require('http').createServer(app.callback()); | |
| const io = require('socket.io')(server, {path: '/remote-control-sockjs'}); | |
| const port = process.env.PORT || 8080; |
This file contains hidden or 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 server = require('http').createServer(); | |
| const io = require('socket.io')(server, { | |
| path: '/remote-control-sockjs', | |
| }); | |
| const port = process.env.PORT || 8080; | |
| server.listen(port); |
This file contains hidden or 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
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:/usr/local/bin:$PATH | |
| # Path to your oh-my-zsh installation. | |
| export ZSH=/Users/bond/.oh-my-zsh | |
| # Set name of the theme to load. Optionally, if you set this to "random" | |
| # it'll load a random theme each time that oh-my-zsh is loaded. | |
| # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
| ZSH_THEME="robbyrussell" |
This file contains hidden or 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
| upstream websocket { | |
| server localhost:3000; | |
| } | |
| server { | |
| listen 80; | |
| server_name localhost; | |
| access_log /var/log/nginx/websocket.access.log main; |
This file contains hidden or 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
| upstream upstream-apache2 { | |
| server 127.0.0.1:8080; | |
| } | |
| upstream upstream-nodejs { | |
| server 127.0.0.1:3000; | |
| } | |
| server { | |
| listen 80; |
This file contains hidden or 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
| # Sets CORS headers for request from example1.com and example2.com pages | |
| # for both SSL and non-SSL | |
| SetEnvIf Origin "^https?://[^/]*(example1|example2)\.com$" ORIGIN=$0 | |
| Header set Access-Control-Allow-Origin %{ORIGIN}e env=ORIGIN | |
| Header set Access-Control-Allow-Credentials "true" env=ORIGIN | |
| # Always set Vary: Origin when it's possible you may send CORS headers | |
| Header merge Vary Origin |
This file contains hidden or 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
| // ref: https://davidwalsh.name/fullscreen | |
| // let's bind the event on body element | |
| var e = document.body; | |
| e.onclick = function() { | |
| if (prefixed(document, "fullScreen") || prefixed(document, "isFullScreen")) { | |
| prefixed(document, "cancelFullScreen"); | |
| } else { |
This file contains hidden or 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
| # I know you've got stuck for too long ^_^Y | |
| # Locale is not configured correct. I don't know what broke that. Maybe time did. | |
| # I fixed it on my ubuntu 14 & 16 servers. | |
| # Follow the steps below or run this script on your machine. | |
| # step 1 | |
| # ensure this line in `/etc/default/locale` file and `/etc/environment` file | |
| # LANG="en_US.UTF-8" | |
| sudo echo '\nLANG="en_US.UTF-8"' >> /etc/default/locale && /etc/environment |
This file contains hidden or 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
| ## 安裝語系檔 | |
| `$ sudo locale-gen "en_US.UTF-8"` | |
| ## 重新設定語系檔 | |
| `$ sudo dpkg-reconfigure locales` | |
| ## 設定檔 |
This file contains hidden or 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
| # quick jump to often used directories | |
| # for linux check the differency mention from: | |
| # http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html | |
| export MARKPATH=$HOME/.marks | |
| function jump { | |
| cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1" | |
| pwd | |
| } | |
| function mark { | |
| mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1" |