Skip to content

Instantly share code, notes, and snippets.

View Phonbopit's full-sized avatar
👻
¯\_ (ツ) _/¯

Chai Phonbopit Phonbopit

👻
¯\_ (ツ) _/¯
View GitHub Profile
{{#foreach posts}}
<div class="post-preview">
<a href="{{url}}">
<h2 class="post-title">{{title}}</h2>
<h3 class="post-subtitle">{{excerpt character="80"}}</h3>
</a>
<p classs="post-meta">Posted by {{author}} on {{date format="MMMM DD, YYYY"}}</p>
</div>
<hr>
{{/foreach}}
<!DOCTYPE html>
<html lang="en">
....
....
<head>
{{ghost_head}}
</head>
<body>
<p class="copyright text-muted">Copyright &copy; Your Website 2014</p>
(function ($) {
"use strict";
var MQL = 1170;
//primary navigation slide-in effect
if ($(window).width() > MQL) {
var headerHeight = $('.navbar-custom').height();
$(window).on('scroll', {
previousTop: 0

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

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
@Phonbopit
Phonbopit / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
mongoose = require "mongoose"
paginate = require('paginate')({
mongoose: mongoose
});
mongoose.set "debug", true
# connection sharing thanks to [connection-sharing mongoose examples](https://github.com/LearnBoost/mongoose/tree/master/examples/express/connection-sharing)
db = global.db = mongoose.createConnection(conf.db.mongoUrl);
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html