Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
<?php | |
// Works in every situations | |
function by_token ($src) { | |
$tokens = token_get_all($src); | |
$count = count($tokens); | |
$i = 0; | |
$namespace = ''; | |
$namespace_ok = false; | |
while ($i < $count) { |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// License: MIT - https://opensource.org/licenses/MIT | |
// Author: Michele Locati <michele@locati.it> | |
// Source: https://gist.github.com/mlocati/7210513 | |
function perc2color(perc) { | |
var r, g, b = 0; | |
if(perc < 50) { | |
r = 255; | |
g = Math.round(5.1 * perc); | |
} | |
else { |
function toUnicode(str) { | |
return str.split('').map(function (value, index, array) { | |
var temp = value.charCodeAt(0).toString(16).toUpperCase(); | |
if (temp.length > 2) { | |
return '\\u' + temp; | |
} | |
return value; | |
}).join(''); | |
} |
xattr -d com.apple.quarantine /path/to/app/myMacApp.app |
<?php | |
namespace App\Authentication; | |
use Auth; | |
use App\Authentication\UserProvider; | |
use Illuminate\Support\ServiceProvider; | |
class AuthServiceProvider extends ServiceProvider | |
{ |
{ | |
// Sample configuration for app in /home/myuser/app dir | |
"uid": "app", | |
"max": 5, // restart the app successively maximum of 5 times | |
"spinSleepTime": 1000, // time to wait until a next restart is attempted (in ms) | |
"append": true, // append the logs, do not overwrite | |
"watch": true, // watch for changes and restart if they occur | |
"script": "server.js", // main startup script (almost like issuing node server.js) | |
"sourceDir": "/home/myuser/app", // the dir where your entire app code resides (dir structure is recursively traversed) | |
"args": ["--myAPIKey", "xBlzdn84fa"] // pass any arguments to your app |
'use strict'; | |
const statusCodes = require('http').STATUS_CODES; | |
function createError(code, name) { | |
return function(message) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = name; | |
this.message = message; | |
this.statusCode = code; | |
} |
<?php // /app/Http/Middleware/Cors.php | |
namespace App\Http\Middleware; | |
use Closure; | |
class Cors { | |
public function handle($request, Closure $next) | |
{ | |
return $next($request) |
This is a list of the most helpful keyboard commands I use within top.
h
shows help on interactive commands. Also see the top manual page
q
to quit the program.