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
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

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
View archive-conditionals.php
<?php
function archive_title() {
//Conditionals to Title Display in WordPress Archive Templates
if( is_archive() ) {
$queried_object = get_queried_object();
if( is_tag() ) {
$slug = $queried_object ? $queried_object->slug : ' ' ;
View add-upstream.md

#tl;dr

setting up a branch to track a repo

pre: assuming you have forked a repo and cloned your fork to your computer

  1. git remote add [maintainer's name] [paste URL here]
  2. git fetch --all
  3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track] At this point you may watch to checkout to your newly create branch and issue a git pull command.
View bower.json
{
"name": "blue-leaf",
"description": "Physics-like animations for pretty particles",
"main": [
"js/motion.js",
"sass/motion.scss"
],
"dependencies": {
"get-size": "~1.2.2",
"eventEmitter": "~4.2.11"
View paginate_array_original.php
<?php
$items = array(1,2,3,4,5,6,7,8,9,10,11,12);
$limit = 5;
$qty_items = count($items);
$qty_pages = ceil($qty_items / $limit);
$curr_page = isset($_GET&#91;'page'&#93;) ? $_GET&#91;'page'&#93; : 1;
$next_page = $curr_page < $qty_pages ? $curr_page + 1 : null;
$prev_page = $curr_page > 1 ? $curr_page - 1 : null;
View schema-wp-extend-output.php
<?php //* do not include php tag
add_filter('schema_output', 'schema_wp_extend_output_987345256');
/**
* Extend / Override Schema Output
*
* @since 1.0
*/
function schema_wp_extend_output_987345256( $schema ) {
View functions.php
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
View Facet log
This file has been truncated, but you can view the full file.
[06-Jan-2017 15:52:30 UTC] PHP Notice: Undefined offset: 3 in /code/wp-content/plugins/facetwp/includes/class-helper.php on line 273
[06-Jan-2017 15:52:30 UTC] PHP Stack trace:
[06-Jan-2017 15:52:30 UTC] PHP 1. {main}() /code/wp-admin/admin-ajax.php:0
[06-Jan-2017 15:52:30 UTC] PHP 2. do_action() /code/wp-admin/admin-ajax.php:91
[06-Jan-2017 15:52:30 UTC] PHP 3. WP_Hook->do_action() /code/wp-includes/plugin.php:453
[06-Jan-2017 15:52:30 UTC] PHP 4. WP_Hook->apply_filters() /code/wp-includes/class-wp-hook.php:323
[06-Jan-2017 15:52:30 UTC] PHP 5. call_user_func_array:{/code/wp-includes/class-wp-hook.php:298}() /code/wp-includes/class-wp-hook.php:298
[06-Jan-2017 15:52:30 UTC] PHP 6. FacetWP_Ajax->refresh() /code/wp-includes/class-wp-hook.php:298
[06-Jan-2017 15:52:30 UTC] PHP 7. FacetWP_Facet->render() /code/wp-content/plugins/facetwp/includes/class-ajax.php:265