Skip to content

Instantly share code, notes, and snippets.

View cabelotaina's full-sized avatar
🏠
Working from home

Maurilio Atila cabelotaina

🏠
Working from home
View GitHub Profile
@santoshshinde2012
santoshshinde2012 / Build Ionic 2 Cordova Apps For Specific Platform Version (config.xml)
Last active October 8, 2019 14:36
Build Ionic 2 Cordova Apps For Specific Platform Version (config.xml)
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
@bentedder
bentedder / calendar.component.html
Last active August 13, 2019 07:01
calendar component angular 4
<div class="calendar">
<div class="calendar-navs">
<div class="month-nav">
<button (click)="prevMonth()">&lt;</button>
<span class="p4">{{ currentDate.format('MMMM') }}</span>
<button (click)="nextMonth()">&gt;</button>
</div>
<div class="year-nav">
<button (click)="prevYear()">&lt;</button>
<span>{{ currentDate.format('YYYY') }}</span>
1. Apresente a árvore de consulta otimizada para a expressão abaixo. Considere todos os dados de eleições da República do Brasil (desde 1892) cadastrados no banco consultado, 98% do número de doações a campanhas feitas por pessoas que não os próprios candidatos, 2% do número de doações com valor superior a 10.000, 1,5% das candidaturas em 2016 e 14% de pessoas rés. Considere ainda cada registro de Pessoa ocupando 256 bytes e índice primário por id<X> para cada tabela <X>, além de índice auxiliar por cada chave estrangeira, D.valor, C.ano e P.dtNasc.
SELECT P.*, SUM(D.valor) AS total,
COUNT (DISTINCT Cand.*) AS nroCands
FROM Pessoa AS P, Doacao AS D, Campanha AS C, Pessoa AS Cand
WHERE P.idP = D.idDoador AND D.idC = C.idC AND
C.idCand = Cand.idP AND P.idP = Cand.idP AND
D.valor > 10.000 AND C.ano > 2015 AND Cand.reu = ‘TRUE’
GROUP BY P.* HAVING total > 100.000
ORDER BY total, nroCands DESC;
@arijusg
arijusg / package.json
Created June 1, 2017 07:48
Pre commit hook - the right way
{
"name": "app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build-prod": "rm -rf dist && ng build --prod --output-hashing none --vendor-chunk true --extract-css false",
"test": "ng test --single-run",
@rafael-neri
rafael-neri / validar_cpf.php
Last active June 27, 2024 01:43
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;
@aitorjs
aitorjs / uploadFile.ts
Last active March 18, 2019 20:40
Upload file using angular2 and nodejs (express)
// FRONTEND (angular2)
// product-form.compontent.html
<input type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
<button type="button" (click)="upload()">Upload</button>
// product-form.compontent.ts
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';
@Component({
@ajskelton
ajskelton / WP Customizer - Textarea
Last active May 14, 2024 04:54
Add a Textarea field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_textarea_setting_id', array(
'capability' => 'edit_theme_options',
'default' => 'Lorem Ipsum Dolor Sit amet',
'sanitize_callback' => 'sanitize_textarea_field',
) );
$wp_customize->add_control( 'themeslug_textarea_setting_id', array(
'type' => 'textarea',
'section' => 'custom_section', // // Add a default or your own section
'label' => __( 'Custom Text Area' ),
@DragonBe
DragonBe / dragdrop.html
Last active March 15, 2021 15:10
Simple Drag and Drop functionality using jQuery and jQuery UI
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Drag and Drop example</title>
<!-- Bootstrap -->
@lpirola
lpirola / install-delibera.sh
Last active June 29, 2016 14:49
Rápida forma de instalar wordpress e utiliza-lo com o plugin do delibera
mkdir desafio-delibera
cd desafio-delibera/
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
# sudo mv wp-cli.phar /usr/local/bin/wp
mv wp-cli.phar wp
wp core download
wp core config --dbname=delibera --dbuser=root
wp core install --path=./ --url=http://localhost:8080 --title=teste-delibera --admin_user=root --admin_password=123 --skip-email --admin_email=teste@teste.com
@kosso
kosso / WP_API_OAuth_Test_client.php
Last active September 16, 2021 05:30
Test PHP client for Wordpress REST API v2.0 / OAuth1.0a 0.3.0
<?php
//opcache_reset(); // Disable local dev MAMP cache
/*
WP_API_OAuth_Test_client.php
Tested with Wordpress 4.7.1
WordPress REST API - OAuth 1.0a Server v.0.3.0 - https://en-gb.wordpress.org/plugins/rest-api-oauth1/