Skip to content

Instantly share code, notes, and snippets.

View matheusdavidson's full-sized avatar

Matheus Davidson matheusdavidson

View GitHub Profile
// Controller
Insc.findById('55db841e16f87bd00bfec6df').populate('orderInsc.items.insc').exec(function(err, insc){
console.log('insc', insc);
});
// Models
var InscSchema = new Schema({
orderInsc: {
type: Schema.Types.ObjectId,
ref: 'Order'
total = 0;
items = [{
produto: id,
qty: x
}]
para cada item -
- verificar plano
- {fee: x, liquid: x}
- subtotal = fee * item.qty
<div class="search-wrapper" search-box>
<input />
<button ng-click="vm.search()"></button>
</div>
'use strict';
angular.module('core.utils').directive('searchBox', /*@ngInject*/ function() {
return {
scope: {},
controller: 'SearchBoxCtrl',
var jwt = require('jsonwebtoken');
var _ = require('lodash');
var secret = 'RS#$09qu43f09qfj94qf*&H#(R';
var refreshSecret = 'rw5&&$$2224124f*&H#(R';
var bcrypt = require('bcrypt');
/**
* UserController
*
* @description :: Server-side logic for managing users
/* REGISTER CONTROLLER */
import Ember from 'ember';
import EmberValidations from 'ember-validations';
export
default Ember.Controller.extend(EmberValidations, {
validations: {
'model.firstName': {
presence: true
},
cep: function() {
var vm = this,
cep = vm.get('model.cep');
getCep(cep);
function getCep(cep) {
if (!cep) {
return;
}
cep: function() {
var vm = this,
cep = vm.get('model.cep');
cepApi(cep);
function cepApi(cep) {
if (!cep) {
return;
}
function atualizacep(cep){
cep = cep.replace(/\D/g,"")
url="http://cep.correiocontrol.com.br/"+cep+".js"
s=document.createElement('script')
s.setAttribute('charset','utf-8')
s.src=url
document.querySelector('head').appendChild(s)
}
function correiocontrolcep(valor){
SELECT
SUM(CASE WHEN FIND_IN_SET('ingles:basico', index_idiomas) THEN 1 ELSE 0 END) AS ingles_basico,
SUM(CASE WHEN FIND_IN_SET('ingles:intermediario', index_idiomas) THEN 1 ELSE 0 END) AS ingles_intermediario,
SUM(CASE WHEN FIND_IN_SET('ingles:fluente', index_idiomas) THEN 1 ELSE 0 END) AS ingles_fluente,
SUM(CASE WHEN FIND_IN_SET('espanhol:basico', index_idiomas) THEN 1 ELSE 0 END) AS espanhol_basico
FROM
esbox_production.default_bc_index
// URL DE ACESSO: http://provedor/seleciona/brindes
// Retorna um JSON com o total de brindes, data e hora
{
total_brindes: "100",
data: "24/03/2015",
hora: "15:05"
}