Resources for learning web design & front-end development:
ONLINE
Design
<?php | |
// Usage: | |
// Before | |
@if ($errors->has('email')) | |
<span>{{ $errors->first('email') }}</span> | |
@endif | |
// After: |
Resources for learning web design & front-end development:
ONLINE
Design
/** | |
* Return a timestamp with the format "m/d/yy h:MM:ss TT" | |
* @type {Date} | |
*/ | |
function timeStamp() { | |
// Create a date object with the current time | |
var now = new Date(); | |
// Create an array with the current month, day and time |
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast) | |
(function poll(){ | |
$.ajax({ url: "server", success: function(data){ | |
//Update your dashboard gauge | |
salesGauge.setValue(data.value); | |
}, dataType: "json", complete: poll, timeout: 30000 }); | |
})(); |
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
Here's all you have to do to add clustering to your node.js application.
cluster.js
, and run cluster.js
instead of server.js
(or /bin/www, or whatever it's called for your project)server.js
filevar cluster = require('cluster');
if (cluster.isMaster) {
// Count the machine's CPUs
var cpuCount = require('os').cpus().length;
var gulp = require('gulp'), | |
compass = require('gulp-compass'), | |
gutil = require('gulp-util'), | |
chalk = require('chalk'), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglify'), | |
imagemin = require('gulp-imagemin'), | |
pngquant = require('imagemin-pngquant'), | |
elixir = require('laravel-elixir'), |
var base_path = __dirname.replace('resources/nodejs', ''); | |
require('dotenv').config({ | |
path: base_path+'.env' | |
}); | |
var port = process.env.NODE_SERVER_PORT, | |
redis = require('redis'), | |
redis_client = redis.createClient(), | |
cookie = require('cookie'), | |
os = require('os'), |
Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.
####Search, Go to, Navigation ####
Cmd + P - Search file
Cmd + Shift + O - Search everywhere
(I swapped the above two recently because I use Cmd + P to search for files most of the time).
alias server='open http://localhost:8000 && python -m SimpleHTTPServer' |