#Real time Apps for Dummies (Socket.io tutorial)
Hello boys and girls,
I just got curious about socket.io and how “real time apps” work.
I already played a little bit with React, meteor and Vue but that’s another story.
<!--- | |
DEMO: http://s3.emerson.link/prints/color-shades-generator.html | |
Source: https://gist.github.com/emersonbroga/0b4ed14474cea2e56bfc13cfa1bae006 | |
--> | |
<!DOCTYPE html> | |
<html lang="en"> |
function dd() { | |
$separator = (php_sapi_name() === 'cli') ? PHP_EOL : '<br/>'; | |
$bt = debug_backtrace(); | |
$caller = array_shift($bt); | |
$args = func_get_args(); | |
call_user_func_array('var_dump', $args); | |
die($caller['file'] .':'. $caller['line'] . $separator); | |
} |
/** | |
* User Controller | |
**/ | |
module.exports = { | |
/** | |
* List | |
* | |
* @route: GET /user | |
* @param req |
#iOS Refernces
##UI
http://click-labs.com/ios-8-design-cheat-sheet-and-free-iphone6plus-gui-psd/
http://www.appcoda.com/customize-navigation-status-bar-ios-7/
http://www.ioscreator.com/tutorials/customizing-navigation-bar-ios8-swift
``
#Save on JSON
var fs = require('fs');
var outputFilename = '/tmp/my.json';
var data = {my: 'json'};
fs.writeFile(outputFilename, JSON.stringify(data, null, 4), function(err) {
if(err) {
console.log(err);
//usage | |
// var alertController = self.createAlertForSettingsPanel("Please, check your settings") | |
// self.presentViewController(alertController, animated: true, completion: nil) | |
func createAlertForSettingsPanel(message: String, title: String = "My Title") -> UIAlertController | |
{ | |
let alertController = UIAlertController( title: title, message: message, preferredStyle: .Alert); | |
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil) |
func displayAView() | |
{ | |
let window = UIApplication.sharedApplication().windows.first as! UIWindow | |
let permissionsView : UIView = UIView(frame: window.frame) | |
permissionsView.backgroundColor = UIColor.redColor() | |
var message : UILabel = UILabel(frame: CGRectMake(100, 200, window.frame.width, 100)) | |
message.textColor = UIColor.whiteColor() | |
message.text = "What a great view!" | |
//Inspired by: http://planetozh.com/blog/2012/10/generate-random-pronouceable-words/ | |
func randomWord(wordLength: Int = 6) -> String { | |
let kCons = 1 | |
let kVows = 2 | |
var cons: [String] = [ | |
// single consonants. Beware of Q, it"s often awkward in words | |
"b", "c", "d", "f", "g", "h", "j", "k", "l", "m", | |
"n", "p", "r", "s", "t", "v", "w", "x", "z", |