Skip to content

Instantly share code, notes, and snippets.

Sam Sargent samsargent

  • Vivo Group
  • Brisbane, Australia
Block or report user

Report or block samsargent

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
samsargent / latest-tweets.js
Created Apr 15, 2013
Grab latest tweets from Twitter API
View latest-tweets.js
Latest Tweets Plugin
Markup required:
<div class="latestTweets" data-user="unitseven" data-count="3"></div>
(function( $ ) {
"use strict";
function relative_time(time_value) {
samsargent / Responsinator.js
Last active Jun 1, 2016
Bookmarklet - simply show the view-port width to make it easy to see what media-query is being used.
View Responsinator.js
/* Responsinator Bookmarklet - simply show the viewport width to make it easy to see what media-query is being applied.
var el=document.createElement('div');'fixed';'50';'300';'-25px -150px 0 0';'unitseven-size';'50%';
samsargent / gist:5087587
Created Mar 5, 2013
Adding SSH Keys to Authorized_Keys
View gist:5087587
cat ~/.ssh/ | ssh USER@HOST "cat >> ~/.ssh/authorized_keys"
View GA EVent Tracking on PDF's.js
ga('send', {
hitType: 'event',
eventCategory: 'Download',
eventAction: 'PDF',
eventLabel: this.href
samsargent / gist:4248885
Created Dec 10, 2012
Dev to production domains in Wordpress
View gist:4248885
update `wp_options` set `option_value` = replace(`option_value`,'','');
update `wp_posts` set `guid` = replace(`guid`,'','');
update `wp_posts` set `post_content` = replace(`post_content`,'','');
update `wp_postmeta` set `meta_value` = replace(`meta_value`,'','');
Going from a development domain to a beta or production url - updating your wordpress database in a few queries. There may or may not be other tables/settings that should be update. I've found the above to work for me.
samsargent / gist:4248667
Created Dec 10, 2012
Loading Users Youtube Videos
View gist:4248667
$.getJSON("{{username}}/uploads?v=2&alt=jsonc&max-results=30", function (data) {
samsargent / gist:4069978
Created Nov 14, 2012
Social Share Count using the JSON API's
View gist:4069978
$.getJSON("", function(data) {
if ((data.count != 0) && (data.count != undefined) && (data.count != null)) {
$("#twbutton").after('<a class="button count"><span>'+data.count+'</span></a>');
$.getJSON("", function(data) {
if ((data.shares != 0) && (data.shares != undefined) && (data.shares != null)) {
View clear-drupal-cache.php
include_once './includes/';
samsargent / lazyload3rdpartyscripts.js
Created Sep 3, 2012
Lazy Loading those 3rd Party Social Widgets slowing down your site (from
View lazyload3rdpartyscripts.js
window.thirdParty = {
init: function() {
$('.share').before('<div class="share preview" onmouseover="thirdParty.load(this);"><img src="/static/images/share.png"></div>');
load: function(el) {
samsargent / Find & Replace Data in MySQL
Created Jun 21, 2012
Find & Replace Data in MySQL
View Find & Replace Data in MySQL
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
You can’t perform that action at this time.