start new:
tmux
start new with session name:
tmux new -s myname
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
# This number should be, at maximum, the number of CPU cores on your system. | |
# (since nginx doesn't benefit from more than one worker per CPU.) | |
worker_processes 8; | |
# Determines how many clients will be served by each worker process. | |
# (Max clients = worker_connections * worker_processes) | |
# "Max clients" is also limited by the number of socket connections available on the system (~64k) | |
# run ss -s and u'll see a timewait param | |
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed. |
#!/bin/bash | |
BASE_PATH=`dirname $0`/.. | |
ASSETS_PATH=$BASE_PATH/app/Resources/assets | |
ASSETS_PATH2=$BASE_PATH/src/SensioLabs/Bundle/InsightAnalysisBundle/Resources/public | |
if [[ `which inotifywait` ]]; then | |
while true; do | |
inotifywait -r -e modify -e move -e create -e delete $ASSETS_PATH/ $ASSETS_PATH2/ | while read line; do | |
php $BASE_PATH/app/console assetic:dump --force |
RESTORE=$(echo -en '\033[0m') | |
RED=$(echo -en '\033[00;31m') | |
GREEN=$(echo -en '\033[00;32m') | |
YELLOW=$(echo -en '\033[00;33m') | |
BLUE=$(echo -en '\033[00;34m') | |
MAGENTA=$(echo -en '\033[00;35m') | |
PURPLE=$(echo -en '\033[00;35m') | |
CYAN=$(echo -en '\033[00;36m') | |
LIGHTGRAY=$(echo -en '\033[00;37m') | |
LRED=$(echo -en '\033[01;31m') |
function mySlowFunction(baseNumber) { | |
console.time('mySlowFunction'); | |
let result = 0; | |
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) { | |
result += Math.atan(i) * Math.tan(i); | |
}; | |
console.timeEnd('mySlowFunction'); | |
} | |
mySlowFunction(8); // higher number => more iterations => slower |
These use separate document structures instead of HTML, some are more modular libraries than full editors
'use strict'; | |
class Abstract { | |
// A static abstract method. | |
static foo() { | |
if (this === Abstract) { | |
// Error Type 2. Abstract methods can not be called directly. | |
throw new TypeError("Can not call static abstract method foo."); | |
} else if (this.foo === Abstract.foo) { | |
// Error Type 3. The child has not implemented this method. | |
throw new TypeError("Please implement static abstract method foo."); |
const proxy = function(vnode){ | |
var doc = vnode.dom.contentDocument || vnode.dom.contentWindow.document; | |
if (doc.readyState === "complete") { | |
m.render( vnode.dom.contentDocument.documentElement, vnode.children ) | |
} else{ | |
setTimeout(function(){proxy(vnode);},0); | |
} | |
} |