Skip to content

Instantly share code, notes, and snippets.

View brunokunace's full-sized avatar
🕶️
Turn down for what?

Bruno Henry brunokunace

🕶️
Turn down for what?
View GitHub Profile
# v2 syntax
version: '2'
services:
mysql-NOME:
image: ambientum/mysql:5.7
container_name: mysql-NOME
volumes:
- ./.docker/mysql:/var/lib/mysql
function pmt(rate_per_period, number_of_payments, present_value, future_value, type){
future_value = typeof future_value !== 'undefined' ? future_value : 0;
type = typeof type !== 'undefined' ? type : 0;
if(rate_per_period != 0.0){
// Interest rate exists
var q = Math.pow(1 + rate_per_period, number_of_payments);
return -(rate_per_period * (future_value + (q * present_value))) / ((-1 + q) * (1 + rate_per_period * (type)));
} else if(number_of_payments != 0.0){
@brunokunace
brunokunace / algo.vue
Last active September 15, 2017 19:26 — forked from WandersonAlves/algo.js
Computed props
computed: {
strokeDashoffset() {
return 339.292 * (1 - (this.computedPercentage / 100))
},
xAxis() {
if (this.computedPercentage >= 100) { return 36 }
if (this.computedPercentage >=0 && this.computedPercentage <=9) { return 47 }
return 42
},
computedDirection() {
Autenticação JWT Vuejs
1)Verifica se existe token no localstorage
1.1)Existe token = fetch para checar se está valido e salva no vuex
1.2)Não existe token = redireciona para tela de login, na qual fará o fetch (item 2)
2)Na tela de login envia os dados para a api e recebe a resposta em json
2.1)Dados corretos = salva o token no localstorage e no vuex
2.2)Dados incorretos = retorna mensagem de erro ao front
3)Adiciona ao axios o valor do header padrão do authorization com o token no vuex
public function test()
{
$cityName = "Viamão";
$stateInitials = "RS";
$states = DB::table('estado')
->join('cidade', function ($join) use ($cityName, $stateInitials) {
$join->on('cidade.Estado_ID', '=', 'estado.ID')
->where('cidade.NomeCidade', '=', $cityName);
})
->where('estado.Sigla', '=', $stateInitials)
import { get } from 'lodash'
/**
* @param schema
* @param data
* @returns {*}
*/
export const dotNotation = (schema, data) => {
const reduce = (accumulate, key) => {
accumulate[schema[key].field] = get(data, schema[key].field, undefined)
// \src\app\modules\auth\services\index.js
import store from 'src/app/infra/store'
import configureUser from 'src/bootstrap/configure/user'
import { promise } from 'src/app/support/utils'
/**
* @param {string} token
* @param {boolean} remember
* @param {Function} success
*/
import http from 'src/app/infra/services/http'
import store from 'src/app/infra/store'
import { register, unRegister, userData } from 'src/app/modules/auth/services'
/**
* @param {Object} credentials
* @param {boolean} remember
* @param {Function} success
*/
export const login = (credentials, remember, success) => {
//select display_name
//from user_profiles
//where id in (select friendships.to_user from friendships where friendships.from_user=1)
//
//union
//
//select display_name
//from user_profiles
//where id in (select friendships.from_user from friendships where friendships.to_user=1)
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CategoryController extends ApiController
{
//que esse maldito controller vai fazer???
}