Skip to content

Instantly share code, notes, and snippets.

View robmarco's full-sized avatar
🇮🇨
Work hard and happy coding my friend!

Roberto Marco robmarco

🇮🇨
Work hard and happy coding my friend!
View GitHub Profile
@robmarco
robmarco / phone_replacement_script.sh
Last active February 26, 2024 16:32
WP Articles – Phone replacement script
#!/bin/bash
WPCLI_COMMAND="./wp-cli.phar search-replace"
WPCLI_COMMAND_PARAMS="--log --skip-plugins"
LOGFILE="debug_log.txt"
function two_digit_mask() {
local phone=$1
local phone_2digit_mask=$(echo "$phone" | tr -d ' -')
echo "$phone_2digit_mask" | sed 's/\([0-9]\{3\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3 \4/'
@robmarco
robmarco / download_chrome41.js
Created September 14, 2018 11:22 — forked from ebidel/download_chrome41.js
For when you need to test your site in Google Search (Chrome 41).
/**
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@robmarco
robmarco / App.js
Created March 9, 2018 22:31 — forked from jesseditson/App.js
ES6 & React Sticky scroll higher-order component example
import React from 'react'
import MyComponent from '../components/MyComponent'
export default class App extends React.Component {
render() {
return <MyComponent topMargin="10"/>
}
}
@robmarco
robmarco / amp-responsive-img.markdown
Last active May 10, 2017 14:32
AMP Img with unknown height/width

AMP Img with unknown height/width

Depending on your need either could be valid. One interesting option is to do option (b) and then style image via CSS with object-fit property (https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit). Usually this is not recommended since it can display image in a imperfect layout. But in your case this could actually be a good compromise. E.g.

<amp-img class="unknown-size" width=300 height=200 src="..."></amp-img>

And CSS would be:

@robmarco
robmarco / README.md
Created September 15, 2016 16:46 — forked from hugodias/README.md
My ZSH Theme

agnoster.zsh-theme

forked by rjorgenson

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
  • NVM
  • RVM
@robmarco
robmarco / GPL-License.md
Last active May 2, 2016 21:25
GPL License

== GPL License

Copyright (C) 2016 [Roberto Marco - roberto@crocode.mobi]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,

@robmarco
robmarco / MIT-License.md
Last active May 2, 2016 21:24
MIT License

== MIT License

Copyright (c) 2016 [Roberto Marco - roberto@crocode.mobi]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# config/application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
@robmarco
robmarco / detectLang.js
Created January 14, 2015 10:25
[AngularJS] Detect Navigation Lang
/*
* detectNavigatorLang ()
*
* Returns selected Language based on Navigator Language
* If the navigator uses spanish, we'll return 'es'.
* Otherwise, returns 'en'
*/
var detectNavigatorLang = function() {
// By default, language is es-ES
var language = 'es-ES';