Skip to content

Instantly share code, notes, and snippets.

View samuelcotterall's full-sized avatar

Samuel Cotterall samuelcotterall

View GitHub Profile

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@samuelcotterall
samuelcotterall / settings.json
Created July 3, 2018 10:22
VS Code Settings
{
"editor.fontSize": 13,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": false,
"editor.renderWhitespace": "all",
"editor.tabSize": 2,
"workbench.iconTheme": "vs-seti",
"editor.cursorStyle": "line-thin",
"trailing-spaces.trimOnSave": true,
"sync.gist": "",
@samuelcotterall
samuelcotterall / Mark parent navigation active when on custom post type single page
Last active February 20, 2018 09:15 — forked from gerbenvandijk/Mark parent navigation active when on custom post type single page
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Getting the post type of the current post
@samuelcotterall
samuelcotterall / random-non-overlapping-position.js
Created September 16, 2017 20:20 — forked from magicznyleszek/random-non-overlapping-position.js
JavaScript -- get random non-overlapping position
// declarations
var positions = [];
// Returns a random integer between min (included) and max (excluded)
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
// generate random positions
@samuelcotterall
samuelcotterall / functions.php
Created January 23, 2017 14:57
Wordpress hide admin bar for logged in users
add_filter('show_admin_bar', '__return_false');
@samuelcotterall
samuelcotterall / compass-to-docksend.rb
Created April 5, 2013 15:55
Sends Compass’ outputted CSS to Transmit’s Docksend
# compass-to-docksend.rb (https://gist.github.com/samuelcotterall/5320424)
#
# Instructions: Put this at the end of config.rb
# Execute AppleScript inside Ruby. I stole this from here: http://porkrind.org/missives/calling-applescript-from-ruby/
def osascript(script)
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten
end
# Send to Transmit

Tweetbot Mute Filters

Football

(?i)(football|soccer|fifa|eufa|footy|goal|free kick|penalty|offside|you blind ref|manchester united|united|man utd|mufc|man city|mcfc|real madrid|fergie|giggs|rooney)

@samuelcotterall
samuelcotterall / infinitescroll.js
Created August 29, 2012 16:10
infinatescroll/masonry
$(window).load(function () {
$('.posts').masonry();
$('.masonryWrap').infinitescroll({
debug: true, // Remove this before going live
navSelector : "div#navigation", // selector for the paged navigation (it will be hidden)
nextSelector : "div#navigation a#nextPage", // selector for the NEXT link (to page 2)
itemSelector : ".entry", // selector for all items you'll retrieve
bufferPx : 10000,
extraScrollPx : 11000,
<div class="toggle">
<p>24 Results</p>
<a href="#">Rating<span></span></a>
</div>
<ul class="stay-list">
<li>
<div>
<h3><a href="http://example.com">Title</a></h3>
<p>From £65.00</p>