Skip to content

Instantly share code, notes, and snippets.

View gabrielizalo's full-sized avatar
🇨🇴

Gabriel Porras gabrielizalo

🇨🇴
View GitHub Profile
@gabrielizalo
gabrielizalo / package.json
Created November 5, 2019 15:42
React App - App Version - Part 2
"build":
"react-scripts build &&
REACTAPPVERSION=$npm_package_version &&
sed -i -- 's/%REACT_APP_VERSION%/'$REACTAPPVERSION'/g' build/index.html &&
echo React App Version = $REACTAPPVERSION",
@gabrielizalo
gabrielizalo / package.json
Created November 5, 2019 14:05
React App - Build Version - Part 2
"build":
"react-scripts build &&
REACTBUILDVERSION=$(date +%Y-%m-%d)-$(date +%T) &&
sed -i -- 's/%REACTBUILDVERSION%/'$REACTBUILDVERSION'/g' build/index.html &&
echo React Build Version = $REACTBUILDVERSION",
@gabrielizalo
gabrielizalo / public.index.html
Last active November 5, 2019 14:15
React App - App Version - Part 1
<meta build-version="%REACT_APP_VERSION%"/>
@gabrielizalo
gabrielizalo / public.index.html
Last active November 5, 2019 14:05
React App - Build Version - Part 1
<meta build-version="%REACTBUILDVERSION%"/>
@gabrielizalo
gabrielizalo / PostArchivePagination.php
Created July 24, 2017 09:21
Wordpress - Post Archive Pagination
// Taken from: https://speckyboy.com/wordpress-snippets-secondary-navigation/
/*
While many WordPress themes have a simple back and forth navigation for post archives, it’s a nice touch to add individual page numbers to the mix. It allows for navigating to a specific page and also gives the user a sense of your content depth.
Note the 'mid_size' argument in the code above. The number placed there will determine the amount of pages seen between the Next and Previous text links.
*/
<?php
the_posts_pagination( array(
'mid_size' => 5, // The number of pages displayed in the menu.
'prev_text' => __( '&laquo; Go Back', 'textdomain' ), // Previous Posts text.
'next_text' => __( 'Move Forward &raquo;', 'textdomain' ), // Next Posts text.
@gabrielizalo
gabrielizalo / JSDropdownMenuOfTags.pjp
Created July 24, 2017 09:20
Wordpress - JS Dropdown Menu of Tags
// Taken from: https://speckyboy.com/wordpress-snippets-secondary-navigation/
/*
If your site takes advantage of WordPress post tags, it may be useful to provide a simple way for users to navigate between them. This is particularly effective for sites with a lot of tags.
For example, a project I worked on used tags as a way to filter posts by a relevant geographic region (of which there were dozens). This dropdown menu utilizes JavaScript to instantly direct the user to whichever tag they choose. You can also do something similar with categories.
*/
<?php
// Show a Drop Down Menu of Tags
echo "<select onChange=\"document.location.href=this.options[this.selectedIndex].value;\">";
echo "<option>Choose a Tag:</option>\n";
foreach (get_tags() as $tag) {
@gabrielizalo
gabrielizalo / BreadcrumbStylePageTitles.php
Created July 24, 2017 09:19
Wordpress - Breadcrumb Style Page Titles
// Taken from: https://speckyboy.com/wordpress-snippets-secondary-navigation/
/*
This snippet will check to see if the current page has a parent. If so, the parent page’s link and title are displayed within the H1 tag at the top of the page. An arrow character is also displayed between the parent and current page title to complete the breadcrumb look.
Note that this breadcrumb effect only goes one level deep. So you’ll have to adjust the code if you want to link to multiple levels (Parent » Level 1 » Level 2).
*/
<h1 class="entry-title">
<?php
// Conditional Statement to Check for a Parent Post
if($post->post_parent) {
$parent_title = get_the_title($post->post_parent);
@gabrielizalo
gabrielizalo / EasilyNavigateWithinASectionOfPages.php
Created July 24, 2017 09:18
Wordpress - Easily Navigate Within a Section of Pages
// Taken from: https://speckyboy.com/wordpress-snippets-secondary-navigation/
/*
This code makes for a great secondary navigation menu that could be used, for example, within a sidebar. It automatically displays the pages within the current section you’re browsing.
As an example, let’s say your site has an About Us page, with subpages for History, Mission Statement and Staff. Users will be able to more easily navigate between the various pages within this section as a bulleted list of links.
*/
<?php
if ( $post->post_parent ) {
$children = wp_list_pages( array(
'title_li' => '',
'child_of' => $post->post_parent,
@gabrielizalo
gabrielizalo / functionCall.ts
Created July 8, 2017 00:25
Typescript - Call function from a JS Library
(<any>window).MyExternalFunction();
@gabrielizalo
gabrielizalo / NoCache.cs
Created July 8, 2017 00:24
.Net - No Cache Headers
// Http 1.1
getCurrentResponse().setHeader("Cache-Control", "no store, no-cache, must-revalidate");
// Http 1.0
getCurrentResponse().setHeader("Pragma", "no-cache");
// Prevents caching at the proxy server
getCurrentResponse().setDateHeader ("Expires", -1);