Skip to content

Instantly share code, notes, and snippets.

# #
# #
# #
# #
# Instalação do Prometheus #
# #
# #
# #
# #
apiVersion: v1
@jorgeguberte
jorgeguberte / ComponentFactory.test.js
Last active August 22, 2022 12:18
Component Factory for Testing in Vue
/*
* as per https://www.youtube.com/watch?v=L_BK8zXGdBM&ab_channel=VueConfToronto
*/
import {shallowMount} from '@vue/test-utils';
describe('test using Component factory', ()=>{
let wrapper;
//Factory
$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo '<pre>';
print_r($row);
echo '</pre>';
}
@jorgeguberte
jorgeguberte / gist:048bc09874da2fda800d
Last active March 23, 2016 16:40
Docker commands
docker-machine ip //Get a Docker machine ip
docker exec -it {$MONGO_INSTANCE_NAME} mongo admin //Enters the mongo admin CLI
docker run --name {$MONGO_INSTANCE_NAME} -p 27017:27017 mongo // Runs mongo and exposes and maps the port
<md-content flex layout-padding>
<div layout="column" layout-fill layout-align="top center">
<p>
The left sidenav will 'lock open' on a medium (>=960px wide) device.
</p>
<p>
The right sidenav will focus on a specific child element.
</p>
<div>
<md-button ng-click="toggleLeft()" class="md-primary" hide-gt-md>Toggle Left</md-button>
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
class Fornecedores extends CI_Controller {
<?php
namespace Entity;
/**
* User Model
*
* @Entity
* @Table(name="fornecedor")
*/
var formulario = angular.module('formularioApp', []);
formulario.directive('formulario-contato', function(){
return{
restrict: 'E',
templateUrl: 'caminho/do/template/do/formulario.html',
controller: function(){
// Aqui dentro vc vai programar o formulário em si.
}
}
@jorgeguberte
jorgeguberte / gist:2ebc6481cc42eef59934
Created September 23, 2015 21:43
Spawn python process in nodejs
var python = require('child_process').spawn('python', ['file.py'], {stdio:'pipe'});
var output = "";
python.stdout.on('data', function(data){
console.log(String(data))
})
console.log(output);
//Essa é a função de callback
mostraPosts(posts){
//mostra os posts
}
pegaPosts(callback){
//Pega os posts, sei lá como.
posts = []
callback(posts);
}