Skip to content

Instantly share code, notes, and snippets.

View samuelcotterall's full-sized avatar

Samuel Cotterall samuelcotterall

View GitHub Profile
@samuelcotterall
samuelcotterall / index.html
Created July 24, 2012 14:52
Adam’s link idea
<script>
var circle = $("a.circle"),
circleOffset = $(circle).offset(),
parent = $(circle).parent('li,p,blockquote'),
parentOffset = $(parent).offset();
// Find position of link
var relativeOffsetTop = parentOffset.top - cirlceOffset.top,
relativeOffsetLeft = parentOffset.left - cirlceOffset.left,;
@samuelcotterall
samuelcotterall / external-link-check.js
Created August 13, 2012 09:30
External Link Check
<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>
@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,

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 / 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
var userInfo = passport.deserializeUser(function(id){
return id;
});
User.findById(userInfo, function(err, user) {
});
function cl_acf_set_language() {
return acf_get_setting('default_language');
}
function get_global_option($name) {
echo acf_get_setting('current_language'); // it
add_filter('acf/settings/current_language', 'cl_acf_set_language');
echo acf_get_setting('current_language'); // en
$option = get_field($name);
remove_filter('acf/settings/current_language', 'cl_acf_set_language');
echo acf_get_setting('current_language'); // it
$("#myformid").find("input, select").on('change', function(){
$("#myElement").addClass("myclass");
});