Skip to content

Instantly share code, notes, and snippets.

View falexandre's full-sized avatar
😎

Fábio Luis Alexandre falexandre

😎
View GitHub Profile
@falexandre
falexandre / app.js
Created August 14, 2017 11:43 — forked from bingeboy/app.js
Upload and display image with NodeJS and Express.
/*
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, common = require('./routes/common')
, fs = require('fs')
, http = require('http')
, util = require('util')
@falexandre
falexandre / gist:0484f3544ca1259b675e8c46b40f8b3b
Created September 4, 2017 12:34 — forked from bkrauska/gist:9742260
DiffMerge git mergetool & difftool setup
Install http://download-us.sourcegear.com/DiffMerge/4.2.0/DiffMerge_4.2.0.697.stable_x64.msi
// this is an adaptation of http://adventuresincoding.com/2010/04/how-to-setup-git-to-use-diffmerge
Then run the following commands from the git bash
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "sgdm --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
@falexandre
falexandre / angular-strLimit
Last active September 21, 2017 10:19
angular strLimit
phoneCat.filter('strLimit', ['$filter', function($filter) {
return function(input, limit) {
if (! input) return;
if (input.length <= limit) {
return input;
}
return $filter('limitTo')(input, limit) + '...';
};
}]);
@falexandre
falexandre / stripHTML
Created September 21, 2017 10:20
Prototype remove html tag javascript
String.prototype.stripHTML = function() {return this.replace(/<.*?>/g, '');}
@falexandre
falexandre / comandos.txt
Created October 5, 2017 23:12
generator-generator
npm install -g generator-generator
npm install -g yo
yo generator
// dentro da pasta do gerador, esse comando serve para poder ser acessivel de qualquer lugar
yo link
//chamando o gerador de qualquer lugar
@falexandre
falexandre / .htaccess
Last active October 30, 2017 23:39
Docker-nginx
RewriteEngine on
### Não permite exibir o mapa dos diretorios
Options -Indexes
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
@Component({
selector: 'add-story-form',
template: `
<div class="container">
<h1>New Story</h1>
<form [formGroup]="newStory"
(submit)="submit($event)"
(success)="onSuccess()"
(error)="onError($event)"
connectForm="newStory">
@falexandre
falexandre / app.module.ts
Last active November 13, 2017 23:35
Store Angular
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { counterReducer } from './store/counter';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
@falexandre
falexandre / nginx.conf
Created January 8, 2018 13:57 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@falexandre
falexandre / default.conf
Created January 9, 2018 08:43
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;