Skip to content

Instantly share code, notes, and snippets.

View marcelo-ribeiro's full-sized avatar

Marcelo Ribeiro marcelo-ribeiro

  • Front-End Developer
  • Salvador, Bahia, Brasil
View GitHub Profile
@marcelo-ribeiro
marcelo-ribeiro / array-create-unique.js
Last active June 17, 2020 03:06
Create Unique Array, Remove Array Duplicates
const products = [
{id: 1, title: "Trim Dress", category: "women", collection: ["new", "featured"]},
{id: 2, title: "Belted Dress", category: "women", collection: ["featured"]},
{id: 3, title: "Fitted Dress", category: "men", collection: ["new"]}
];
const categories = new Set(
products.map(product => product.category)
);
@paulstelzer
paulstelzer / start.html
Created September 11, 2018 12:47
Ionic 4 Transparent Header
<ion-header>
<ion-toolbar color="secondary" [class.show-background]="showToolbar">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-buttons slot="end">
<ion-button>
<ion-icon slot="icon-only" name="logo-facebook"></ion-icon>
</ion-button>
@marcelo-ribeiro
marcelo-ribeiro / javascript-remove-accents.js
Last active May 21, 2023 09:17 — forked from fabiofdsantos/angularJS_removeAccents.js
An Javascript function to remove accents and others characters from an input string.
// Example: https://codepen.io/marcelo-ribeiro/pen/OJmVOyW
const accentsMap = new Map([
["A", "Á|À|Ã|Â|Ä"],
["a", "á|à|ã|â|ä"],
["E", "É|È|Ê|Ë"],
["e", "é|è|ê|ë"],
["I", "Í|Ì|Î|Ï"],
["i", "í|ì|î|ï"],
["O", "Ó|Ò|Ô|Õ|Ö"],
@anestan
anestan / remove_p_from_images.php
Created November 30, 2016 08:19
Remove P Tags From Images - Wordpress
function filter_ptags_on_images($content) {
$content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
return preg_replace('/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU', '\1', $content);
}
add_filter('the_content', 'filter_ptags_on_images');
@varmais
varmais / thinced.js
Created October 1, 2015 19:43
Geolocation to Promise wrap example
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
@ericelliott
ericelliott / defaults-overrides.md
Last active May 7, 2023 13:52
ES6 defaults / overrides pattern

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({
    bar = 'no',
    baz = 'works!'
  } = {}) {
@bobbygrace
bobbygrace / trello-css-guide.md
Last active April 22, 2024 10:15
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@robdmoore
robdmoore / setup-cordova-phonegap.ps1
Last active September 13, 2023 16:04
Scripted/Automated installation script to set up Cordova/PhoneGap and Android on Windows
# Run this in an elevated PowerShell prompt
<# This script worked on a fresh Windows Server 2012 VM in Azure and the following were the latest versions of each package at the time:
* Chocolatey 0.9.8.27
* java.jdk 7.0.60.1
* apache.ant 1.8.4
* android-sdk 22.6.2
* cordova 3.5.0-0.2.6
* nodejs.install 0.10.29
#>
# Note: there is one bit that requires user input (accepting the Android SDK license terms)
@tjhole
tjhole / WORDPRESS: Base64 Image to Wordpress Uploads directory
Created May 9, 2014 12:35
WORDPRESS: Base64 Image to Wordpress Uploads directory
function tattoo_submit() {
if (isset($_POST["addtattoo"])) {
$title = "Tattoo : ". $_POST["tatooInput"];
$my_post = array(
'post_title' => $title,
'post_status' => 'publish',
'post_author' => 1,