Skip to content

Instantly share code, notes, and snippets.

👷‍♂️
exploring

marcosfreitas marcosfreitas

👷‍♂️
exploring
Block or report user

Report or block marcosfreitas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@marcosfreitas
marcosfreitas / m3.sh
Last active Mar 30, 2019
press key to continue
View m3.sh
function PressKeyToContinue() {
printf "\n";
question="Pressione S para continuar ou qualquer outra tecla para pular essa parte execução do script";
expected_key_pressed='s';
abort_script=false;
if [ ! -z "$1" ]; then
question="${1}";
@marcosfreitas
marcosfreitas / isAlmostPalindrome.php
Created Jul 9, 2018
#training Is A Palíndrome word
View isAlmostPalindrome.php
<?php
# check for palindrome words
# if the word have almost 1 letter to be changed to be a plindrome, it will be a palíndrome.
function isAlmostPalindrome($word) {
$count_diference = 0;
$word_reverse = strrev($word);
$word_as_array = str_split($word);
View Controller.php
<?php
namespace App\Controllers\Site\Ads;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Silex\Api\ControllerProviderInterface;
class AdsControllerProvider implements ControllerProviderInterface {
@marcosfreitas
marcosfreitas / wp-title.php
Created Jul 10, 2017
combinação de títulos para o title do html
View wp-title.php
<title>
<?php
if(is_home()):
bloginfo('name');
elseif( is_category() || is_tag() ):
single_cat_title(); echo ' &bull; '; bloginfo('name');
elseif( is_single() || is_page() ):
single_post_title();
else:
@marcosfreitas
marcosfreitas / get_date.php
Last active Jun 2, 2017
Abstraction to get date e anyone formats
View get_date.php
<?php
/**
* Check if a string is a valid based on $formats['input'], then format an output based on $formats['output']
* @author Marcos Freitas
* @param string $value The string of the date
* @param array $formats The given input and wanted output formats of the date.
* @return string|boolean
*/
public static function getDate($value, $formats){
@marcosfreitas
marcosfreitas / mf-pagination.php
Created Jan 12, 2017
Create a custom pagination based on total of pages received
View mf-pagination.php
<style>
.mf-pagination {
display: block;
list-style: none;
margin: 2em 0 0 0;
width: 100%;
padding: 1em;
text-align: right;
font-size: 1.2em;
}
@marcosfreitas
marcosfreitas / .htaccess
Created Oct 29, 2016
rewrite folder "web/" inside silex
View .htaccess
# Project'a Structure
# localhost/projects/myProject/
# -- .htacess
# | -- RewriteEngine On
# | -- RewriteBase /projects/myProject/
# | -- DirectoryIndex web/index.php
# -- src/
# ----- App/
# -- web/
View soap.class.php
<?php
namespace App;
/**
* Esta classe é apenas um Wrapper para a classe SoapClient e realiza as requisições e recebe as respostas de forma padrão.
*/
class Soap {
public
View share.js
function gpShare(url, title, descr, image, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('https://plus.google.com/share?url=' + url + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
function fbShare(url, title, descr, image, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
@marcosfreitas
marcosfreitas / index.html
Last active Jan 29, 2016
[UPDATED] Responsive Images, using img element. -- The First Image are loading wrong.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Responsive Image</title>
</head>
<body>
<div class="videos">
You can’t perform that action at this time.