This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calculadoraAdicaoSubtrcao(numero, outroNumero, operacao) { | |
// Verifica se a váriavel operação é diferente de "-" e "+", | |
// caso seja, é retornado zero pois a função só realiza some e subtração | |
if (operacao !== "-" && operacao !== "+") { | |
return 0; | |
} | |
// Se a a váriavel operação é igual a "+" retornamos o resultado da soma | |
if (operacao === "+") { | |
return numero + outroNumero; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
double r = 0, pi = 3.14159; | |
char buffer[100]; | |
fgets(buffer, 100, stdin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// disparando | |
(function($) { | |
var element = $(window.activePageId + ' #{{obj.id}}'); | |
var event = new Event('{{obj.id}}'); | |
event.relatedTarget = element; | |
document.dispatchEvent(event); | |
})(jQuery); | |
// escutando | |
document.addEventListener('coeSubCategoryHeader', function(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (ultimo lis) | |
(cond | |
((null? lis) (display "Lista nula!")) | |
((null? (cdr lis)) (display (car lis))) | |
(else (ultimo (cdr lis))) | |
) | |
) | |
(ultimo '(A B C D E F B A D Z)) | |
(newline) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replace accented characters | |
* @param $string | |
* | |
* @return string | |
*/ | |
public function stripAccents($string) | |
{ | |
return preg_replace('/[`^~\'"]/', null, iconv('UTF-8', 'ASCII//TRANSLIT', $string)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replace language-specific characters by ASCII-equivalents. | |
* @see http://stackoverflow.com/a/16427125/529403 | |
* @param string $s | |
* @return string | |
*/ | |
public static function normalizeChars($s) | |
{ | |
$replace = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Aplica uma máscara a string | |
* | |
* @param $str | |
* @param $mask | |
* | |
* @return string | |
*/ | |
function str_mask($str, $mask) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Help menu | |
print_help() { | |
cat <<-HELP | |
This script is used to fix permissions of a Drupal installation | |
you need to provide the following arguments: | |
1) Path to your Drupal installation. | |
2) Username of the user that you want to give files/directories ownership. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Show all errors | |
ini_set('display_errors', 1); | |
/** | |
* Compilation includes configuration file | |
*/ | |
define('MAGENTO_ROOT', getcwd()); | |
// Include bootstrap file and Mage Class file | |
require MAGENTO_ROOT . '/app/bootstrap.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".views-exposed-form #edit-cor .form-item label").each(function(){ | |
var color = $(this).text(); | |
$(this).parent('div.form-item').addClass(filterColor(color)); | |
}); | |
function filterColor(color){ | |
if(typeof color === 'string'){ | |
if($.inArray(color, Drupal.settings.avanz.colors)!== -1){ | |
return cleanString(color.toLowerCase().replace(/ +/g, "-")); | |
} |
NewerOlder