Skip to content

Instantly share code, notes, and snippets.

# dd if=/dev/zero of=/swapfile bs=1024 count=1024000
# mkswap /swapfile
# swapon /swapfile

Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading
<a href="{{ shop.url }}">
<img
src="{{ 'logo.png' | asset_url }}"
alt="{{ shop.name }}"
data-retina-src="{{ 'logo.svg' | asset_url }}">
</a>
<script type="text/javascript">
Modernizr.addTest('retina', function () {
return (!!navigator.userAgent.match(/Macintosh|Mac|iPhone|iPad/i) && window.devicePixelRatio==2);
});
@CameronGilroy
CameronGilroy / convert ts to mp4
Created June 3, 2014 05:25
Convert ts files from video stream to one mp4 video file
ls *.ts | awk 'BEGIN {print "ffconcat version 1.0"}{print "file " $1}' > segments.ffconcat
ffmpeg -i segments.ffconcat -bsf:a aac_adtstoasc -acodec copy -vcodec copy final.mp4

Keybase proof

I hereby claim:

  • I am camerongilroy on github.
  • I am camerongilroy (https://keybase.io/camerongilroy) on keybase.
  • I have a public key ASAmvTX7Fj9lAXMggxhX12sqbst8F2__GPwhfMeWVXSq_Qo

To claim this, I am signing this object:

@CameronGilroy
CameronGilroy / functions.php
Created May 13, 2018 00:31 — forked from stephanieleary/functions.php
Redirect private page 404 errors to the login screen with a message
<?php
add_action( 'wp', 'my_private_page_404' );
function my_private_page_404() {
$queried_object = get_queried_object();
if ( isset( $queried_object->post_status ) && 'private' == $queried_object->post_status && !is_user_logged_in() ) {
wp_safe_redirect( add_query_arg( 'private', '1', wp_login_url( $_SERVER['REQUEST_URI'] ) ) );
exit;
}
<?php
/**
* Hook: woocommerce_before_main_content.
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
* @hooked WC_Structured_Data::generate_website_data() - 30
*/
@CameronGilroy
CameronGilroy / gist:5141caaa8308fc2941a9f07192cf024d
Created June 18, 2019 21:07
Oxygen editor console error log when givewp.com is installed
Note: The site owner has disabled Google Analytics tracking for your user role. app-5cda2213f911c80f508142c7.closte.com:70:11
ReferenceError: tinymce is not defined
app-5cda2213f911c80f508142c7.closte.com:55049:1
<anonymous> https://app-5cda2213f911c80f508142c7.closte.com/?ct_template=fundraising&ct_builder=true&ct_inner=true:55049
Error: $ is not a function
@https://app-5cda2213f911c80f508142c7.closte.com/wp-content/plugins/oxygen/component-framework/angular/controllers/ui.min.js:1:1162
X@https://app-5cda2213f911c80f508142c7.closte.com/wp-includes/js/jquery/jquery.js:3:4562
prop@https://app-5cda2213f911c80f508142c7.closte.com/wp-includes/js/jquery/jquery.js:4:13165
@https://app-5cda2213f911c80f508142c7.closte.com/wp-content/plugins/oxygen/component-framework/angular/controllers/ui.min.js:1:1133
invoke@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.js:4138:17
@CameronGilroy
CameronGilroy / Display_Spots.php
Created July 22, 2019 00:59
Display how many spots are left in the choice label when using the GP Limit Choices perk
<?php
/**
* Display how many spots are left in the choice label when using the GP Limit Choices perk
* https://gravitywiz.com/gravity-perks/
*/
add_filter( 'gplc_remove_choices', '__return_false' );
add_filter( 'gplc_pre_render_choice', 'ayc_add_how_many_left_message', 10, 5 );
function ayc_add_how_many_left_message( $choice, $exceeded_limit, $field, $form, $count ) {
$limit = rgar( $choice, 'limit' );
$how_many_left = max( $limit - $count, 0 );
<script>
document.addEventListener("DOMContentLoaded", function() { //is the page fully loaded, (the quiz is built with JS so this cant run before the quiz is loaded) https://wordpress.org/plugins/ultimate-viral-quiz/
document.querySelector(".single-post .uvq-quiz-container hr").remove();
document.querySelector(".single-post .uvq-quiz-container .text-description-content").remove();
document.querySelector(".single-post .uvq-quiz-container .col-md-6").classList.add('col-md-12');
document.querySelector(".single-post .uvq-quiz-container .col-md-6").classList.remove('col-md-6');
});
</script>