Skip to content

Instantly share code, notes, and snippets.

View enapupe's full-sized avatar

Iacami Gevaerd enapupe

View GitHub Profile
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;
#include <stdio.h>
#include <stdlib.h>
int main(){
int max=3, i=0, j=0, k=0, l=max;
int x[max], y[max], z[max+max];
printf("Digite os valores para o array X\n");
for(i=0; i<max; i++){
scanf("%d", &x[i]);
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
int menu();
void imprimeConcurso();
void carregaConcurso();
void test();
//A less clean solution, is to change the syntax of the AngularJS template tags. Just add the following statement during module instantiation:
var my_app = angular.module('MyApp').config(function($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
});
'use strict';
var gulp = require('gulp');
var imacss = require('gulp-imacss');
var imagemin = require('gulp-imagemin');
var pngcrush = require('imagemin-pngcrush');
gulp.task('imacss', function () {
gulp.src('app/images/sprites/**/*.svg')
.pipe(imagemin({
progressive: true,
<?php
function clean_da_svg($svg){
$remover[] = 'xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"';
$remover[] = 'xmlns:xlink="http://www.w3.org/1999/xlink"';
$remover[] = 'x="0px" y="0px"';
$remover[] = '<defs></defs>';
$remover[] = 'version="1.1"';
$remover[] = "\r";
$remover[] = "\n";
$remover[] = "\r\n";
@enapupe
enapupe / notification.css
Created August 29, 2014 13:24
AngularJS Notification Service
.notifications-service {
position: fixed;
top: 10px;
width: 100%;
text-align: center;
}
.notification-list {
list-style: none;
padding: 0;
margin: 0;
@enapupe
enapupe / autofocus.directive.js
Created September 16, 2014 19:00
Directive that autofocus an element when scope becomes true
myApp.directive("focusMe", function($timeout){
return {
restrict: "A",
link: function(scope, element, attrs){
scope.$watch(attrs.focusMe, function(value){
if(value === true){
$timeout(function(){
element[0].focus();
});
}
@enapupe
enapupe / reset.js
Created November 6, 2014 11:34
AngularJS auto $setPristine() on reset
angular.module("myApp").directive("form", function(){
return {
require: "^form",
link: function(scope, elem, attr, ctrl){
elem.on("reset", function(){
ctrl.$setPristine();
});
}
};
});
@enapupe
enapupe / tooltip.directive.js
Created November 12, 2014 14:15
AngularJS tooltip directive
angular.module("myApp").directive("theTooltip", function($timeout, $sce){
return {
restrict: "E",
template: "<tooltip-arrow arrow-top></tooltip-arrow><tooltip-content ng-bind-html=\"content\"></tooltip-content><tooltip-arrow></tooltip-arrow>",
link: function(scope, elem, attr){
scope.$on("tooltip.show", function(undefined, newval){
elem.css("visibility", "hidden");
scope.content = $sce.trustAsHtml(newval.content);
// aplicamos o escopo para forçar a renderizacao do novo content
// no tooltip, e assim poder calcular o novo tamanho no próximo