Skip to content

Instantly share code, notes, and snippets.

@alberto-marin
alberto-marin / snippets.cson
Created April 8, 2017 07:53
AMP (Accelerated Mobile Pages) html boilerplate for atom.io
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values
#
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson
#
'.text.html':
'AMP HTML Project':
@alberto-marin
alberto-marin / page.php
Created June 7, 2017 09:36
How to add jQuery in WordPress
<script type="text/javascript">
jQuery(document).ready(function($) {
(function($){
console.log($('.scroll-nav').height());
})(jQuery);
});
</script>
@alberto-marin
alberto-marin / gulpfile.js
Created June 23, 2017 23:04
gulp+sass+browsersync
// Gulp.js configuration
'use strict';
const
// source and build folders
dir = {
src : './src/',
build : './var/www/wp-content/themes/mytheme/'
},
// Gulp and plugins
@alberto-marin
alberto-marin / gist:e3c1e7c17b35139dd0ab8094ad851f11
Created May 24, 2018 08:48
Javascript - Loop through child elements and change its class
/*
**
** Steps
**
*/
var steps = document.getElementById('steps');
steps.firstElementChild.classList.toggle('active');
var children = steps.children;
@alberto-marin
alberto-marin / index.js
Created November 5, 2022 18:14
Example sensitive data in props
export default function Home(props) {
// Now you can see your secret key just by using the React Developer Tools for Firefox/Chrome
[...]
}
export async function getServerSideProps() {
// call API to get the secret key
const options = {