Skip to content

Instantly share code, notes, and snippets.

Nico Pernice yumyo

Block or report user

Report or block yumyo

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
View google-doc-cms-test.php
<?php
// This was a quick proof of concept from 2009, use the script freely - https://www.realisingdesigns.com/web-design-articles/using-google-docs-quick-easy-cms/
// Specify document
$gd_doc = "dd9zpc9r_4jh8qv76j";
$gd_doc_type = "doc";
$gd_array = array();
$gd_array["doc"]["url"] = "http://docs.google.com/View?id=".$gd_doc;
$gd_array["doc"]["start"] = '&lt;div id="doc-contents"&gt;';
@yumyo
yumyo / index.html
Created May 15, 2019
simple-landing
View index.html
<div class="img"></div>
<div class="hatch"></div>
@yumyo
yumyo / post-receive
Last active May 17, 2019
WP Dev/Test/Live ENV post-receive hook #devops
View post-receive
# The PROD directory
PROD="/var/www/main.domain/"
# The TEST directory
TEST="/var/www/test.domain/"
# The DEV directory
DEV="/var/www/dev.domain/"
# A temporary directory for deployment
TEMP="/home/[server_user]/temp-deploy/"
# The Git repo
REPO="/home/[server_user]/git-domain-bare/"
View WP-Autoload.php
<?php
/*
The MIT License (MIT)
Copyright (c) 2015 Twitter Inc.
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
@yumyo
yumyo / WP Objects
Created Jul 4, 2018
List of WP Objects structure (WP_Post, WP_Post_Type, WP_Term)
View WP Objects
WP_Post Object
(
[ID] => 50491
[post_author] => 520
[post_date] => 2016-10-18 19:00:46
[post_date_gmt] => 2016-10-18 18:00:46
[post_content] =>
[post_title] => Home
[post_excerpt] =>
[post_status] => publish
View gist:89d34fffe3e862ba13ed98556e4ad1f9
(
[ID] => 2849
[date] => 1505489663
[post_type] => post
[sticky] =>
[format] => image
[url] => http://mysite/mypost
[url_target] => _self
[title] => Lorem Ipsum is not simply random text.
[excerpt] => Contrary to popular belief, Lorem Ipsum is not simply random text.
@yumyo
yumyo / what-forces-layout.md
Created Oct 9, 2017 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@yumyo
yumyo / translate-service
Created Aug 14, 2017
WordReference as a Service AppleScript
View translate-service
on run {input, parameters}
set phrase to input as string
set phrase to quoted form of phrase
set from_lang to "en"
set to_lang to "it"
do shell script "open 'https://www.wordreference.com/'" & from_lang & to_lang & "'/'" & phrase
end run
@yumyo
yumyo / SCSS.md
Created Jul 19, 2017 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do
View SCSS.md

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@yumyo
yumyo / wp-meta_cache.php
Last active Jun 21, 2017
An alternative to transient and object-cache
View wp-meta_cache.php
$cache_key = '_ssr-schedule';
$cache = get_post_meta( $frag_ID, $cache_key, true );
if ( empty( $cache ) || $cache['expires'] < time() ) {
$var = '[path]';
$url = '[path]' . $var;
$request = wp_remote_get( $url, array( 'timeout' => 120, ) );
if( is_wp_error( $request ) ) { return false; }
$response = wp_remote_retrieve_body( $request );
$data = json_decode( $response, true ); // `true` translate into an array instead of an object
You can’t perform that action at this time.