Skip to content

Instantly share code, notes, and snippets.

View robertpop's full-sized avatar
🎯
Focusing

Robert robertpop

🎯
Focusing
View GitHub Profile
@aaronthorp
aaronthorp / mail-sendgrid.js
Last active November 9, 2017 03:23
SMTP via SendGrid using Email package with Meteor
if (Meteor.isServer) {
Meteor.startup(function () {
process.env.MAIL_URL = 'smtp://username:[email protected]';
Accounts.emailTemplates.siteName = "My Website Name";
Accounts.emailTemplates.from = "My Website Name <[email protected]>";
Accounts.emailTemplates.resetPassword.subject = function(user) {
return "How to reset your password for My Website Name";
@ebinnion
ebinnion / bootstrap_wp_link_pages.php
Last active March 14, 2017 10:02
Extends the WordPress wp_link_pages function in order to style the page links with Bootstrap's classes.
@Tjorriemorrie
Tjorriemorrie / directives.js
Last active December 21, 2015 10:39
bootstrap 3 datetimepicker directive
'use strict'
angular.module('directives', [])
.directive('dateTimePicker', function() {
return {
restrict: 'E',
require: ['ngModel'],
scope: {
ngModel: '='
@jboulhous
jboulhous / push.md
Created July 16, 2013 11:37
Push to github from cloud9

Add a git remote in the Cloud9 console. Should look like this (replace the git url with your repo url):

git remote add origin [email protected]:C9Support/testPush.git 

Add files and commit them:

git add . 
git commit -m "First commit"

Push to github:

@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@banago
banago / infinite-previous-next-looping.php
Last active March 28, 2024 11:31
Infinite next and previous post looping in WordPress
<?php
/**
* Infinite next and previous post looping in WordPress
*/
if( get_adjacent_post(false, '', true) ) {
previous_post_link('%link', '&larr; Previous Post');
} else {
$first = new WP_Query('posts_per_page=1&order=DESC'); $first->the_post();
echo '<a href="' . get_permalink() . '">&larr; Previous Post</a>';
wp_reset_query();
@JoostKiens
JoostKiens / functions.php
Last active April 22, 2019 09:58
Improve the WordPress caption shortcode with HTML5 figure & figcaption, microdata & wai-aria attributes
<?php
/**
* Improves the WordPress caption shortcode with HTML5 figure & figcaption, microdata & wai-aria attributes
*
* Author: @joostkiens
* Licensed under the MIT license
*
* @param string $val Empty
* @param array $attr Shortcode attributes
* @param string $content Shortcode content
@plasticmind
plasticmind / gist:4337952
Created December 19, 2012 16:20
Adds a confirmation dialogue to the WordPress publish button.
/* = Add a "molly guard" to the publish button */
add_action( 'admin_print_footer_scripts', 'sr_publish_molly_guard' );
function sr_publish_molly_guard() {
echo <<<EOT
<script>
jQuery(document).ready(function($){
$('#publishing-action input[name="publish"]').click(function() {
if(confirm('Are you sure you want to publish this?')) {
return true;
@cosenary
cosenary / index.php
Last active June 14, 2019 19:49
Instagram PHP API - Likes
<?php
require 'Instagram.php';
use MetzWeb\Instagram\Instagram;
$instagram = new Instagram(array(
'apiKey' => 'YOUR_APP_KEY',
'apiSecret' => 'YOUR_APP_SECRET',
'apiCallback' => 'YOUR_APP_CALLBACK'
));
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter