Skip to content

Instantly share code, notes, and snippets.

View mreis1's full-sized avatar

Reis mreis1

View GitHub Profile
@mreis1
mreis1 / nginx.conf
Created November 30, 2016 01:12
nginx.conf sample for reverse proxy
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@mreis1
mreis1 / highchart sparkline
Created December 8, 2016 14:09
Highcharts sparkline
/**
*
usage:
<div data-sparkline="71, 78, 39, 66 "></div>
*/
@mreis1
mreis1 / angular-ui-date-usage-examples.md
Created January 24, 2017 21:59
angular-ui-date usage examples

#angular-ui-date

angular-ui-date is a plugin which wraps around jqueryui

Please refer to jquery ui options for more information about supports parameters. To set jqueryui datepicker options you must pass the configuration object to the directive as follows: ui-date="{..}"

This plugin as 2 different states.

  • The value that is rendered in the input as a string
  • The ngModel property that by default is a Date object that reflects the datestring from the input field

#angular-ui-date

angular-ui-date is a wrapper around jqueryui's datepicker. Please refer to their documentation and option list for more information about supports parameters. To set jqueryui datepicker options you must pass the configuration object to the directive as follows: ui-date="{..}"

This plugin works has 2 different sides.

  • The value being rendered to the client as the input value.
  • The ngModel property which is a Date object (by default) that reflects the value in the same input

The last topic might not be desired as we are going to see and for that we must use the ui-date-format directive as we are about to see.

@mreis1
mreis1 / grunt-usemin.md
Last active January 24, 2017 22:32
grunt-usemin tips and tricks

#grunt-usemin tips and tricks

-[Root]
...
--package.json
--gruntfile.js
--app
----index.html
----main.js
@mreis1
mreis1 / script-to-limit.js
Created January 26, 2017 10:13
String toLimit generator
/***
* This javascript extension allow us to clip string to a particular length when bigger than the limit
* or to generate extra characters if provided string length is below the limit
*
* "this is an awesome title built ".toLimit(50, '#')
* output => "this is an awesome title built ###################"
*
* "".toLimit(50)
* "--------------------------------------------------"
*
@mreis1
mreis1 / sample.js
Created February 2, 2017 09:23
Javascript inheritance
/**
* This is a helper function that loops over properties from b
* and appends it to a. It also outputs a
*/
function __extend(a, b){
//loop nas own properties do objecto b
for (var x in b){
if (b.hasOwnProperty(x)) a[x] = b[x];
}
function __() { this.constructor = a; /* definir o constructor da nossa nova classe como sendo o constructor da classe que estamos a extender */ }
//form a npm depency list extract the exact version a generate a string for npm install
var obj = { "@angular/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/material": "^2.0.0-beta.1",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "~3.4.0",
chrome://flags/#overscroll-history-navigation
Desc: Disables the swipe functionallity that performs history back and forward
credits: https://productforums.google.com/forum/#!topic/chrome/9cfN_d5wfzw
@mreis1
mreis1 / htaccess
Created April 2, 2017 19:35
htaccess force https. Redirect HTTP to HTTPS automatically
# BEGIN HTTPS Redirection Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS Redirection Plugin