Skip to content

Instantly share code, notes, and snippets.

View Z4P0's full-sized avatar

Luis Rosario Z4P0

View GitHub Profile
#macro ( createProductionsArray $productionFolders )
"productions": [
#if( !$productionFolders.isEmpty() )
#foreach( $production in $productionFolders )
{
"machine-name": "$production.getChild("name").value",
#set( $detailsBlock = $_XPathTool.selectSingleNode($production, "system-folder/system-block/system-data-structure/theatre-production") )
<!--#protect"title": "$_EscapeTool.java($detailsBlock.getChild("title").value)",#protect-->
}#if( $foreach.hasNext ),#end
#end
@Z4P0
Z4P0 / oneliners.js
Created April 4, 2019 00:05 — forked from mikowl/oneliners.js
👑 Awesome one-liners you might find useful while coding.
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// Type this in your code to break chrome debugger in that line.
// smooth scrolling, modified from the css-tricks
// https://css-tricks.com/snippets/jquery/smooth-scrolling/
// ----------------------------------------
function smoothScrollHandler () {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length ? $target : $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
$('html, body').animate({
scrollTop: $target.offset().top
@Z4P0
Z4P0 / special-offers.html
Created March 29, 2016 19:10
the markup for the site
<h3 class="header-7 pink-dark">Pole Position Raceway</h3>
<ul data-accordion data-allow-all-closed="true" role="tablist" class="accordion featured-accordion no-margin-bottom">
<li class="accordion-item"><strong class="header-2 pink">$5 Off First Race coupon</strong>
<div id="panel1" role="tabpanel" data-tab-content aria-labelledby="panel1-heading" class="accordion-content">
<p>Panel 1. Lorem ipsum dolor</p>
</div><a id="panel1-heading" href="#panel1" role="tab" aria-controls="panel1" class="accordion-title">+ Show More</a>
</li>
</ul>
@Z4P0
Z4P0 / ExportingViews.md
Created March 15, 2016 21:04 — forked from mankyKitty/ExportingViews.md
Guide to exporting Views in Drupal 6/7 into your module so you can keep them safe in version control. You *ARE* using version control right?

Exporting Views

This guide assumes you have a module ready to save the views but it does not have any Views integration or folder structure. Skip ahead if you've already created the folders and Views Hooks.

  • Add the views folder to your module.
  • Create a file called MODULENAME.views.inc inside the views folder.
  • Add a default_views folder inside the views folder.

Your module directory structure should now resemble something like this:

@Z4P0
Z4P0 / psuedo-video-effect.scss
Created February 23, 2016 20:34
use an image and give it a subtle animation
.bg-test {
height: rem-calc(200);
width: rem-calc(200);
background-color: transparent;
position: relative;
overflow: hidden;
&:after {
content: "\0a0";
background-color: #f0f;
display: inline-block;
@Z4P0
Z4P0 / yahoo-finance-stock-data.js
Created February 15, 2016 21:33
Yahoo Finance stock historical data, prices and details retrieval function written in Javascript, jQuery and YQL
/*
Yahoo Finance stock historical data, prices and details retrieval function written in Javascript, jQuery and YQL
v2013-08-05
(c) 2013 by Fincluster ltd - http://fincluster.com <dev@fincluster.com>
*/
(function($) {
function getStock(opts, type, complete) {
var defs = {
desc: false,
baseURL: 'http://query.yahooapis.com/v1/public/yql?q=',
<?php
// machine name, display, additional arguments
// site.com/admin/structure/views/view/meet_the_team_ver_1/edit/block_1
print views_embed_view('meet_the_team_ver_1', 'block_1', $node->nid);
?>
<?php
// module invoke
$contact_us_block = module_invoke('nodeblock', 'block_view', '82');
print render($contact_us_block['content']);
?>