Skip to content

Instantly share code, notes, and snippets.

View emersonbroga's full-sized avatar
:octocat:
Let's code!

Emerson Brôga emersonbroga

:octocat:
Let's code!
View GitHub Profile
@emersonbroga
emersonbroga / index.html
Last active October 3, 2016 04:01
CSS Color Shades Generator
<!---
DEMO: http://s3.emerson.link/prints/color-shades-generator.html
Source: https://gist.github.com/emersonbroga/0b4ed14474cea2e56bfc13cfa1bae006
-->
<!DOCTYPE html>
<html lang="en">
@emersonbroga
emersonbroga / Readme.Md
Last active August 7, 2016 15:34
Real time Apps for Dummies (Socket.io tutorial)

#Real time Apps for Dummies (Socket.io tutorial)

#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.

@emersonbroga
emersonbroga / dd.php
Created September 25, 2015 18:26
dd.php Debug and die.
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);
}
@emersonbroga
emersonbroga / UserController.js
Created September 17, 2015 18:27
Node JS Base Controller
/**
* 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
``
@emersonbroga
emersonbroga / node-json.md
Last active August 29, 2015 14:26
NodeJs and Json Files: Read and Save

#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!"
@emersonbroga
emersonbroga / randomWord.swift
Last active April 22, 2024 15:59
Swift Random Word Generator
//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",
@emersonbroga
emersonbroga / q.md
Created June 30, 2015 00:19
Is there a better way to work with promises and callback?

#Is there a better way to work with promises and callback?

synchronous programming pseudo example:

var result = doSomething();

var param = (result[x]) ? 'foo' : 'bar';